mongolite icon indicating copy to clipboard operation
mongolite copied to clipboard

Need for insertOne() command in order to get the _id that was generated

Open LucasMelo3 opened this issue 5 years ago • 2 comments

There is a need to get the insertId field with the _id value of the just inserted document, which is already available in db.collection.insertOne() from the mongoDB.

There are database use cases that you need to retrieve the _id that was automatically generated, to use it right away after inserting. Is there any option available in mongolite? Is it possible to implement as insertOne?

Thank you in advance!

LucasMelo3 avatar Apr 20 '19 18:04 LucasMelo3