I'm on 2.2.2 and this works fine. The doc var is only available when the
function is executed by a hook and it IS the document that is triggering
the hook.
>From your exception, it looks like doc is not defined (maybe you are
executing it directly?) and that getDatabase is missing "()". Even so, I
don't recognize the format of that error which makes me wonder if we're
even on the same version.
Also, yes, you can use the orient.getDatabase() method. The following is
equivalent:
var db = orient.getDatabase();
var og =(db.getTransaction().isActive())
?orient.getGraph()
:orient.getGraphNoTx();
var oe = og.getElement(doc.field('@rid'));
var isV = (oe.getElementType() === 'Vertex');
var isE = (oe.getElementType() === 'Edge');
--
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.