db.collection.
aggregate
(pipeline, options)
allowDiskUse属于options里面,pipeline必须是数组时,才可以使用options且在数组外。
db.xiaoxu.aggregate([{$group:{_id:”$xiaoxu”,totoal:{$sum:1}}}],{allowDiskUse:1})
[thread1] Error: command failed: {
“ok” : 0,
“errmsg” : “Unrecognized pipeline stage name: ‘allowDiskUse'”,
“code” : 40324,
“codeName” : “Location40324″
db.xiaoxu.aggregate([{$group:{_id:”$xiaoxu”,totoal:{$sum:1}}}],{allowDiskUse:true})
{ “_id” : “1234”, “totoal” : 7 }
{ “_id” : “456”, “totoal” : 2 }
xiaoxu 已回答的问题