Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Update API - allow scripted upserts #7143
In some scenarios it is useful if the update script used to add new content to an existing document is also capable of being called when the document does not already exist (aka Upsert requests).
Now that we have stored scripts they can be non-trivial chunks of code and may have a lot of business logic to manage the state of an item. Object orientation teaches us the value of encapsulation and this enhancement allows the scripts to encapsulate the logic used in the construction of new documents as well as the current logic for modifying existing documents.
The suggested change is that a new