Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Finding document by objectId #12

Closed
fvisticot opened this issue Nov 1, 2018 · 1 comment
Closed

Finding document by objectId #12

fvisticot opened this issue Nov 1, 2018 · 1 comment

Comments

@fvisticot
Copy link

When inserting document, an objectId is returned.
Is it possible to find document based on the returned objectId using the toString() method of the ObjectId ?

@marioreggiori
Copy link
Owner

You should be able to find the document by using

db.first({'_id': insertedId.toString()});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants