NodeRed addorupdate node not working as expected

Hi Allan,
I am using an addorupdate node in node red in order to update my collection, but unfortunately the unique attribute seems to not work some of the times. I have the unique attribute on the name of the collection entry, but I still get multiple entries with the same name instead of updating the old one.

This is the code I use to call the addorupdate node:
image
This is the configuration of the addorupdate node:
image
This is a case of the problem in openflow:


This is a working case:

Are the two similar items in the same array msg.items ?
In that case i’m 100% sure it will “fail” and add two items …
If not … how long are there between the two inserorupdate’s ? with mongodb there will always be a small delay between something i added and until you can “find” it again, so if there is onl a few mili seconds between the two inserorupdate’s this could happen ( in the case you could fix it with a unique index )

lastly ( but that does not seem to be the issue here )
uniqeness respect’s the ACL … so if two users use the same uniqeness and items they cannot see, it will be allowed. ( uniqeness is checked BY the user doing the insertorupdate, so if the user cannot see the item that already exists, it WILL get added as a new item )

The msg.items are unique in a sense that they do not share the same name, or that shouldn’t happen at least. the addorupdate is running once every 30 minutes, so it should have properly registered by then. If you look at the timestamps in the created you can see the delay, and also that the update is at the same timestamp. It should update the older ones but it is instead creating a new one.

I just made a small test and cannot reproduce that.
Please create a small workflow that shows adding an item and then updating it with insertorupdate that only create new items every time.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.