Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-703

mongoc_collection_get_last_error returns WriteResult

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.5.0
    • Affects Version/s: None
    • Component/s: Docs
    • None
    • None
    • Major Change
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            christopher.wang Christopher Wang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: