组(按猫鼬)? [英] Group (By) in Mongoose?
本文介绍了组(按猫鼬)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经在shell中构造了我想要的查询,但是用Mongoose编写查询时遇到了麻烦.
I've constructed the query I want in the shell but am having trouble writing it in Mongoose.
db.commentstreams.group({ key: { page_id: true }, reduce: function(obj,prev) { prev.num_comments += obj.num_comments }, initial: { num_comments: 0 } })
我对Mongoose语法有点困惑;也许有人可以对此有所了解.非常感谢.
I'm a bit confused by the Mongoose syntax; perhaps someone could shed some light on this one. Much thanks.
推荐答案
Unfortunately we seem to be lacking documentation for this one.
这篇关于组(按猫鼬)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文