MongoDB allowDiskUse not working..

后端 未结 3 1196
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-05 14:55

Experts.

I\'m new to MongoDB, but know enough to get my self in trouble.. case in point:

db.test.aggregate(
[
    {$group: {_id: {email: \"$email\", ge         


        
3条回答
  •  攒了一身酷
    2021-02-05 15:27

    Please use aggregate query in run command,it will allow to use allowDiskUse tag.

    db.runCommand(
       { aggregate: "test",
         pipeline: [
                    {$group: {_id: {email: "$email", gender: "$gender"}, cnt: {$sum: 1}}}, 
                    {$group: {_id: "$_id.email", cnt: {$sum: 1}}}, 
                    {$match: {cnt: 2}}
                   ],
         allowDiskUse: true
       }
    )
    

提交回复
热议问题