首页 文章
  • 3 votes
     answers
     views

    MapReduce,MongoDB和node-mongodb-native

    我正在使用node-mongodb-native库在MongoDB上运行MapReduce(来自node.js) . 这是我的代码: var map = function() { emit(this._id, {'count': this.count}); }; var reduce = function(key, values) { return {'te...
  • 2 votes
     answers
     views

    在mongoDB中使用Monk限制查找

    我有大量的文件 . 我想获得前100个 . 从Monk Docs,这是我正在使用的查找方法 var documents = []; users.find({}, function (err, docs){ for(i=0;i<100;i++) documents.push(docs[i]); }); 这非常浪费,因为无论如何都要检索整个文档 . 我想要这样的东西(来自mong...
  • 2 votes
     answers
     views

    MongoDB节点本机驱动程序创建重复文档

    我在使用mongodb-native-driver保存文档更新时收到重复文档 . 我第一次调用 save() 正确创建了文档,并添加了一个带有ObjectID值的_id . 第二次调用使用原始ObjectID的文本_id创建一个新文档 . 例如,我最终得到: > db.people.find() { "firstname" : "Fred", &quo...

热门问题