[CDRIVER-703] mongoc_collection_get_last_error returns WriteResult Created: 11/Jun/15  Updated: 19/Oct/16  Resolved: 11/Oct/16

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

Type: Bug Priority: Minor - P4
Reporter: Christopher Wang Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Major Change

 Description   

The doc for mongoc_collection_insert says,

If no _id element is found in document, then a bson_oid_t will be generated locally and added to the document. You can retrieve a generated _id from mongoc_collection_get_last_error().

This is wrong on master and 1.2.0-dev. On both, mongoc_collection_insert upgrades the "gle" bson object to a write command result like:

{ "nInserted" : 1, "nMatched" : 0, "nRemoved" : 0, "nUpserted" : 0, "writeErrors" : [  ] }

The result has no generated _id. And it contradicts the documentation, which calls this a getLastError document.



 Comments   
Comment by Githook User [ 11/Oct/16 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-703 update mongoc_collection_get_last_error doc
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/cbdd47d7fe223039c4166c42d4afb4d7567ed1e1

Comment by A. Jesse Jiryu Davis [ 23/Mar/16 ]

Update _test_legacy_bulk_insert when fixing.

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