node.js - Aggregate: return document with no subdocument OR with latest subdocument only -
this more complex version of the query in question
i've got these mongoose schemas:
var thread = new schema({ title: string, messages: [message] }); var message = new schema({ date_added: date, author: string, text: string });
how return threads latest message
subdocument (limit 1) , threads without message
subdocuments well?
Comments
Post a Comment