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

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

php - Boolean search on database with 5 million rows, very slow -

css - Text drops down with smaller window -