Skip to content

Instantly share code, notes, and snippets.

@A
Created February 23, 2014 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save A/9170474 to your computer and use it in GitHub Desktop.
Save A/9170474 to your computer and use it in GitHub Desktop.
Get the only one embed document by id from array of subdocuments.
Room.findOne({'chat._id': messageID, 'users': req.user._id}, {'chat.$': 1}, function (err, room) {
console.log(room); // {chat: MessageInstance};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment