-
Type: Improvement
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: libmongoc
-
(copied to CRM)
-
Needed
-
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.
- related to
-
PHPLIB-428 Report successfully inserted IDs after bulk write errors
- Backlog