DEV Community

Discussion on: How to use Populate in Mongoose & Node.js

Collapse
 
laygir profile image
Liger

Mongo newbie here ๐Ÿ‘‹๐Ÿป
Is it possible to do findOne after the populate?

The query string I have available belongs to the referenced document. I would like to first populate it and then find the document I am looking for.

Other wise I first need to do a findOne in one collection and pass the result to another collectionโ€™s findOne.

I am trying to avoid an unnecessary findOne operation but maybe I am overthinking it and its okay to do multiple findOneโ€™s to reach a result?

Another solution comes to my mind is to make the query string I have available an indexed unique field so I can directly do findOne.