Insert or Update if exists, based on a field other than objectId?

Is it possible to do that?

And if I can’t, and I need to first query for the object, then update it, how can I ensure between network requests the object won’t be modified by another client?

Hi Gal,

The “save” method does what you want, I think. It updates object if it exists, and creates new if it doesn’t.

Doesn’t seem to be the case for me. It seems “save” creates a new entry unless it finds an existing entry based on objectId. My question is whether it’s possible to do this without knowing the objectId ahead of time.

How would Backendless match the objects without their identity, which is objectId?

Well I hoped you’d tell me that :slight_smile:

  1. By allowing me to decide if an entry is unique based on a field other than objectId


  1. By allowing me to “lock” an entry or perform so sort of atomic operation. Then I could first query for an existing entry, then update if found and otherwise add a new one, will without other users modifying the entries involved in the process.

Both these things are not supported directly by Backendless. Our only way of identifying objects is by objectId and there is not “lock” concept currently.

So if you need some of these, you should find some way to implement it manually.