开发者

mongodb: how to just get the count of subsets but no subset retrieving

开发者 https://www.devze.com 2023-02-18 17:58 出处:网络
I just read the document of http://www.mongodb.org/dis开发者_开发问答play/DOCS/Retrieving+a+Subset+of+Fields

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消