有没有办法从 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
});
});
});
可能有更好的方法来做到这一点,所以我也愿意。谢谢。