我有以下查询:
uno = db.prueba.aggregate(
{$project: {a_gt_b: {$cmp: ['$num-a','$num-b']}}},
{$match: {a_gt_b:{$gt:0}}},
{$group:{"_id":"$a_gt_b",total:{"$sum":1}}},
{$project: {"_id":0,"total":1}}
);我想要执行$explain命令,根据这个answer,我必须接受$match部分,但我不知道如何执行。
发布于 2015-04-19 19:23:08
这个答案已经过时了(我会更新)。从MONGO2.6开始,您可以使用explain your aggregation结果:
db.orders.aggregate([
# put your whole aggregation query
], {
explain: true
})https://stackoverflow.com/questions/29734634
复制相似问题