[CDRIVER-271] mongoc_collection_save doesn't insert documents with user set id's Created: 07/Jan/14  Updated: 03/May/17  Resolved: 22/Jan/14

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: 0.90.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Matthew Wilkinson Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 12, Mongo 2.4.8


Attachments: File save.c    

 Description   

Follow the semantics on http://docs.mongodb.org/manual/reference/method/db.collection.save/

Save should upsert the document if it already has an id (currently uses MONGOC_UPDATE_NONE instead of MONGOC_UPDATE_UPSERT)

Also save should replace the document entirely and not $set fields

I attached an untested version of mongoc_collection_save that I think should work.



 Comments   
Comment by Christian Hergert [ 22/Jan/14 ]

Nice catch! fixed in master.

Generated at Wed Feb 07 21:08:58 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.