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

Include inserted _Ids in insert_one() and insert() results

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.28.0
    • Affects Version/s: None
    • Component/s: libmongoc
    • Needed
    • Hide

      Need to state that the inserted _id can be returned in the reply in the insert_one() documentation.

      Show
      Need to state that the inserted _id can be returned in the reply in the insert_one() documentation.

      As per http://mongoc.org/libmongoc/current/mongoc_collection_insert_one.html and http://mongoc.org/libmongoc/current/mongoc_collection_insert.html, there is currently no option to return the generated _id(s):

      If no _id element is found in document, then a bson_oid_t will be generated locally and added to the document. If you must know the inserted document’s _id, generate it in your code and include it in the document. The _id you generate can be a bson_oid_t or any other non-array BSON type.

      Although providing the inserted id(s) is not required according to the MongoDB CRUD spec, it would be useful to expose this in the C driver to assist downstream drivers such as mongolite that use libmongoc.

            Assignee:
            julia.garland@mongodb.com Julia Garland (Inactive)
            Reporter:
            stephen.steneker@mongodb.com Stennie Steneker (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: