mongoDB中如何使用max求最大值

2025-05-04 01:38:08
推荐回答(1个)
回答1:

你可以写一个js的脚本就行了,比如按照下面的方式来写。

var cursor = db.collection.find();
while (cursor.hasNext()) {
...obj = cursor.next();
...//do max
}

或者,你也可以写一个MapReduce。