[DRIVERS-239] SaveOne and SaveMany added to CRUD Spec Created: 25/Jun/15  Updated: 26/Jun/17  Resolved: 04/Oct/16

Status: Closed
Project: Drivers
Component/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Craig Wilson Assignee: Craig Wilson
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on CSHARP-1336 Add Idempotent SaveOne and SaveMany t... Closed
Related
Driver Compliance:
Key Status/Resolution FixVersion
PERL-544 Won't Fix
CSHARP-1336 Won't Fix

 Description   

The CRUD specification has added saveOne and saveMany to aid users in performing idempotent saves. Previously, users were required to do a replaceOne with an upsert. While this was doable, it was annoying to specify when this is such a common scenario.

There is a difference in implementation for drivers that mutate documents vs. those that do not. In the former case, if a document is "saved" without an identifer, the driver will generate one just like it does for insert. However, drivers that do not mutate will reject the save with an error or exception. This is due to the requirement for this operation to be idempotent. The details are spelled out in the spec.

Yaml/JSON tests have been added.



 Comments   
Comment by Christian Amor Kvalheim [ 04/Oct/16 ]

Save is misleading as it replaces the whole document causing possible concurrency issues and lost data. The correct way is to use the replaceOne method on the crud api or atomic operations.

Generated at Thu Feb 08 08:21:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.