Mongodb/Mongoose in Node.js. Finding by id of the nested document Mongodb/Mongoose in Node.js. Finding by id of the nested document mongoose mongoose

Mongodb/Mongoose in Node.js. Finding by id of the nested document


If you're trying to find an embedded document then the syntax is:

User.findOne({_id: id}, function(err, user) {    var embeddedDoc = user.embeddedDocs.id('embeddedDocId');});