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

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -