Hi Team, Is @upsert tag is mandatory for upsert?
I am not using upsert tag but I have a trigram index and It’s creating two different nodes( two uuid) instead of single node and its linking, Though I am using conditional uspert : [@if(eq(len(child),0)].
Here is query.
scenario
1.Though I am using conditional mutation ( via checking count of the node) so that transaction won’t create 2 nodes of “smart Opt2”.
2. Not using upsert tag but I have trigram index.
Does it mean I need to add an upsert tag if I am using transactions?
The Upsert Directive has to be used in the case you need to check uniqueness on the fly (in concurrent transactions, not “global”). I’m not sure about the relation with trigram index, perhaps it is a bug. In that case, share a complete code in a gist. So we can reproduce it or tell what is wrong in the code.
BTW, trigram index is just an index. Not sure what you mean by “but I have trigram index”. Can you clarify? to make sure if it is a bug or not.
If you need the Upsert Directive behavior, yes.
I think if you take care of avoiding concurrent mutations from your client, you don’t need the upsert directive - I mean, make sure you have control of those scenarios instead of relying on that directive. And the Upsert Block is recommended for general cases.