如何使用node-mongodb-native在mongodb find()的callback中返回临时集合?

有没有办法从find()操作而不是游标返回临时集合? 我正在使用node-mongodb-native驱动程序,我想对find()操作的结果运行mapReduce。 像这样的东西:

client.open(function(err) { client.collection(collectionName, function(err, collection) { collection.find( {days_since_epoch: {$gte: query.begin}).toArray(function(err, docs) { // Need to run a mapReduce here on the results // Preferably on a temporary collection instead of the default cursor or array above }); }); }); 

可能有更好的方法来做到这一点,所以我也会为此而努力。 谢谢。

不,但地图减lessfunction需要一个查询,所以你不需要发现:)

http://mongodb.github.com/node-mongodb-native/api-generated/collection.html#mapreduce