Get one most recent comment for each post in mongodb -
i have 2 collections in mongodb, 1 posts , 1 comments. best approach 1 recent comment each post? i'm looking similar solution mongodb: http://www.xaprb.com/blog/2006/12/07/how-to-select-the-firstleastmax-row-per-group-in-sql/
you should able aggregation framework combining $group $max.
i give exact solution, can't unless give example of data.
by way: proper way structure data in mongodb put comments sub-array of posts.
Comments
Post a Comment