Closed JohnAD closed 6 years ago
@SSPkrolik ,
Mind reviewing this branch? For the project I'm working on, getting insert to return a driver-generated _id
s is critical to it's function. I've got a work around for the moment, but as I use nimongo
more I'd rather not depend on the work-around.
BTW, returning the _id
is the same behavior seen in the Mongo shell and the other official libraries.
https://docs.mongodb.com/manual/applications/drivers/
And, from the MongoDB specifications for drivers:
https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#write
/**
* Inserts the provided document. If the document is missing an identifier,
* the driver should generate one.
*
* @see https://docs.mongodb.com/manual/reference/command/insert/
* @throws WriteException
*/
Thx for the contribution!
This update adds any missing
_id
from inserted documents and stores those in aseq[Bson]
in StatusReply so that end user can identify the newly inserted documents. This is akin to what the Mongo Shell and related libraries typically do:https://docs.mongodb.com/manual/reference/method/db.collection.insertMany/#insertmany-examples
http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.insert_many
ref: issue #45