Group (By) in Mongoose?

后端 未结 4 1285
盖世英雄少女心
盖世英雄少女心 2021-02-12 15:18

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(         


        
4条回答
  •  轮回少年
    2021-02-12 15:42

    According to this post:

    Model.find({}, [fields], {'group': 'FIELD'}, function(err, logs) { 
            ... 
    }); 
    

    Unfortunately we seem to be lacking documentation for this one.

提交回复
热议问题