I've added a trigger for 'onBeforeUpdate'

In the hook function I check for some conditions and based on that I delete 
the current item. Although the item gets deleted, it's index entry doesn't. 
Is there some other way I can do this?

//toJSObject is a custom function to convert Java object to Javascript Objects.

var dirtyFields = doc.getDirtyFields();

dirtyFields = toJSObject(dirtyFields);    

if(dirtyFields.indexOf('flags') >= 0 ){
   var flags = toJSObject(doc.field('flags'));
   if(flags.length == 0){
      var id = doc.field('@rid');
      db.delete(id);
      return 'RECORD_REPLACED';
   }
}

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to