mongodb: how to just get the count of subsets but no subset retrieving
I just read the document of http://www.mongodb.org/dis开发者_开发问答play/DOCS/Retrieving+a+Subset+of+Fields
So I hide the comments in blog list page, but, I want to show comments count in list page.
So how to do the aggregation of subset but no subset retrieving
Best to maintain a dedicated comments counter variable as part of your blog post document. Denormalization in this case is much faster and efficient than performing some kind of counting.
精彩评论