|
db.data.aggregate([{"$group": {_id : "$code", total : {"$sum" : 1}}},{"$sort" : {_id: 1}}])
the problem is that it takes a very long time to compute (severals minutes). this is too slow. is there any way to speed up this operation ? i tryed to create an index on "code" field but with no success
db.data.createIndex({code:1})what can I do to make this aggregation faster ?
thank you
db.stats();