You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice if replace returned generated_keys, like insert does when inserts happen.
The use case here is to do something like "Atomically updating a document based on a condition" from the Cookbook. If a new record is created, I'd like to know that record's ID without having to do returnChanges: true and pick it out of the larger structure.
I think generated_keys wouldn't really fit into replace, because replace never "generates" a key. The keys must be given beforehand.
It seems like "inserted keys" would be the right thing here?
We have been planning to deprecate generated_keys completely in favor of adding a new return_keys option instead, see #3074 (comment) . The return_keys option would make a keys value appear in the write result, which would look similar to generated_keys, but would include the primary keys of all inserted documents.
I think that might handle your use case.
Activity
danielmewes commentedon May 9, 2016
I think
generated_keyswouldn't really fit intoreplace, becausereplacenever "generates" a key. The keys must be given beforehand.It seems like "inserted keys" would be the right thing here?
We have been planning to deprecate
generated_keyscompletely in favor of adding a newreturn_keysoption instead, see #3074 (comment) . Thereturn_keysoption would make akeysvalue appear in the write result, which would look similar togenerated_keys, but would include the primary keys of all inserted documents.I think that might handle your use case.