Search code examples
orientdborientdb2.2

OrientDB: How to use MATCH in an UPDATE operation?


Is it possible to use MATCH in an UPDATE operation? I've tried things like this:

UPDATE (MATCH...RETURN...) SET...

I assumed it would work, since this does:

UPDATE #12:34 SET...

But I've not been successful with any syntax I could come up with.

So if this is supported, what is the correct syntax to use?


Solution

  • Yes, you can do it, but the MATCH has to return persistent records, eg.

    RETURN $elements

    or (in v 3.0)

    RETURN expand(x)

    If you are using v 3.0, please consider that you just gave me a chance to find a bug (thank you!), so you will have a NullPointerException on the RC2. I already fixed it, the fix will be in the snapshot in a few minutes and will be released with the first 3.0.0 GA