Tag: robomongo

为什么mongo不能返回所有的字段?

我有一个位置和名称作为字段的集合。 我用下面的mongoose创build了名字索引, eventSchema.index({name: 'text'}); 当我运行这个robomongo,它返回所有12个字段, db.getCollection('_event').find({"location.country":"United States"}) 但是当我运行这个robomongo,它只返回值与两个字段,ID和位置, db.getCollection('_event').find({$text: {$search: "2017 Honda"}},{"location.country":"United States"})

在MongoDb聚合上出错

我一直在本地build立我的应用程序,所有工作正常,它使用最新的MongoDB 3.4和我的聚合调用工作正常。 app.get('/random_menu', function (req, res) { Menus.aggregate([{$sample: {size: 1}}], function (err, data) { res.json(data); }); }); 我现在已经把我的代码移动到了我的树莓派,它仅限于MongoDB 2.4.10,看起来我的聚合函数不能工作。 我的应用程序不返回任何数据,并没有任何错误。 为了testing,我通过RoboMongo尝试了下面这个,它在当地的3.4版本上工作正常: db.getCollection('menus').aggregate([{$sample: {size: 1}}]) 但是,当我尝试通过RoboMongo pi分贝,我得到以下错误: assert: command failed: { "errmsg" : "Pipeline::parseCommand(): unrecognized field \"cursor", "ok" : 0 } : aggregate failed _getErrorWithCode@src/mongo/shell/utils.js:23:13 doassert@src/mongo/shell/assert.js:13:14 assert.commandWorked@src/mongo/shell/assert.js:266:5 DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1215:5 @(shell):1:1 Error: command failed: { "errmsg" : "Pipeline::parseCommand(): […]

MongoDb查找给出奇怪的响应的查询

我正在尝试用nodejs在mongodb中search数据。 这是我的查询 collection.find({ age: { '$gt': 20 } }); 它在robomongo工作得很好,但在我的申请中给了我这个回应 Readable { pool: null, server: null, disconnectHandler: { s: { storedOps: [], storeOptions: [Object], topology: [Object] }, length: [Getter] }, bson: {}, ns: 'versioncontrol.Branch/contacts', cmd: { find: 'versioncontrol.Branch/contacts', limit: 0, skip: 0, query: { age: [Object] }, slaveOk: true, readPreference: { preference: 'primary', tags: undefined, […]

authSource在mongo数据库url中意味着什么?

我想连接到我的mongo数据库与以下连接string var Mongo_url = 'mongodb://MyUSer:tech@localhost:27017/chatme?authSource=admin'; 我得到错误 assertionError: null == { [MongoError: Authentication failed.] name: 'MongoError', message: 'Authentication failed.', ok: 0, code: 18, 任何人都可以请清除这个“authSource =pipe理”的事情给我。

MongoDB 3.0.1 auth问题 – RoboMongo

我已经将MongoDB 3.0.1安装在服务器(Ubuntu14.04)中。 我需要为我的MongoDB启用远程身份validation,以便它只能被注册用户看到。 一旦安装Mongo,我已经运行这些命令: > use admin switched to db products > db.createUser({user: "userAdmin", pwd: "admin1234", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]}) 这是我的/etc/mongod.conf“: dbpath = /var/lib/mongodb logpath = /var/log/mongodb/mongod.log logappend = true port = 27017 bind_ip = 127.0.0.1,SERVER_IP auth = true 如果我尝试与RoboMongo连接,我会收到此消息 YES – Connected to SERVER_IP NO – Authorization failed 如果我尝试从我的浏览器( […]