在获得mongo授权后,使用mocha进行流星速度测试失败

时间:2015-08-25 22:52:00

标签: meteor mocha meteor-velocity

使用--auth参数保护mongo后,收到以下错误消息:

  

MongoError:没有授权mocha执行命令{listIndexes:“users”,cursor:{}}

mongo位于默认端口localhost:27017上的本地计算机上。 谷歌和stackexchange搜索没有任何相似之处,所以任何帮助都会受到赞赏。

据推测,我需要做的就是授权用户使用'mocha'数据库。 谁是用户?

完整堆栈跟踪:

W20150822-22:58:09.173(1)? (STDERR) 

/Users/malcolm/.meteor/packages/velocity_meteor-tool/.1.1.3_2.1uk1vnq++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:278
W20150822-22:58:09.173(1)? (STDERR)                         throw(ex);
W20150822-22:58:09.173(1)? (STDERR)                               ^
W20150822-22:58:09.214(1)? (STDERR) MongoError: not authorized on mocha to execute command { listIndexes: "users", cursor: {} }
W20150822-22:58:09.214(1)? (STDERR)     at Object.Future.wait (/Users/malcolm/.meteor/packages/velocity_meteor-tool/.1.1.3_2.1uk1vnq++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:398:15)
W20150822-22:58:09.214(1)? (STDERR)     at [object Object].MongoConnection._ensureIndex (packages/mongo/mongo_driver.js:733:1)
W20150822-22:58:09.214(1)? (STDERR)     at [object Object].Mongo.Collection._ensureIndex (packages/mongo/collection.js:620:1)
W20150822-22:58:09.215(1)? (STDERR)     at Accounts.urls (packages/accounts-base/accounts_server.js:1309:1)
W20150822-22:58:09.215(1)? (STDERR)     at /private/var/folders/3n/2yry_ys510q6dx0frpznpc4c0000z_/T/meteor-test-run15cht13/.meteor/local/build/programs/server/packages/accounts-base.js:1616:4
W20150822-22:58:09.215(1)? (STDERR)     at /private/var/folders/3n/2yry_ys510q6dx0frpznpc4c0000z_/T/meteor-test-run15cht13/.meteor/local/build/programs/server/packages/accounts-base.js:1659:3
W20150822-22:58:09.215(1)? (STDERR)     at /private/var/folders/3n/2yry_ys510q6dx0frpznpc4c0000z_/T/meteor-test-run15cht13/.meteor/local/build/programs/server/boot.js:222:10
W20150822-22:58:09.215(1)? (STDERR)     at Array.forEach (native)
W20150822-22:58:09.215(1)? (STDERR)     at Function._.each._.forEach (/Users/malcolm/.meteor/packages/velocity_meteor-tool/.1.1.3_2.1uk1vnq++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20150822-22:58:09.215(1)? (STDERR)     at /private/var/folders/3n/2yry_ys510q6dx0frpznpc4c0000z_/T/meteor-test-run15cht13/.meteor/local/build/programs/server/boot.js:117:5
W20150822-22:58:09.215(1)? (STDERR)     - - - - -
W20150822-22:58:09.216(1)? (STDERR)     at Object.toError (/Users/malcolm/.meteor/packages/mongo/.1.1.0.1ruc6ua++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/utils.js:114:11)
W20150822-22:58:09.216(1)? (STDERR)     at /Users/malcolm/.meteor/packages/mongo/.1.1.0.1ruc6ua++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/db.js:1194:31
W20150822-22:58:09.216(1)? (STDERR)     at /Users/malcolm/.meteor/packages/mongo/.1.1.0.1ruc6ua++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/db.js:1903:9
W20150822-22:58:09.216(1)? (STDERR)     at Server.Base._callHandler (/Users/malcolm/.meteor/packages/mongo/.1.1.0.1ruc6ua++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/base.js:453:41)
W20150822-22:58:09.216(1)? (STDERR)     at /Users/malcolm/.meteor/packages/mongo/.1.1.0.1ruc6ua++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/server.js:487:18
W20150822-22:58:09.216(1)? (STDERR)     at [object Object].MongoReply.parseBody (/Users/malcolm/.meteor/packages/mongo/.1.1.0.1ruc6ua++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
W20150822-22:58:09.216(1)? (STDERR)     at [object Object].<anonymous> (/Users/malcolm/.meteor/packages/mongo/.1.1.0.1ruc6ua++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/server.js:445:20)
W20150822-22:58:09.216(1)? (STDERR)     at [object Object].emit (events.js:95:17)
W20150822-22:58:09.216(1)? (STDERR)     at [object Object].<anonymous> (/Users/malcolm/.meteor/packages/mongo/.1.1.0.1ruc6ua++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:207:13)
W20150822-22:58:09.217(1)? (STDERR)     at [object Object].emit (events.js:98:17)

1 个答案:

答案 0 :(得分:1)

现在答案显而易见,我已经解决了。

无法读取mocha数据库的用户是MONGO_URL中的用户,在此示例中为myUser

export MONGO_URL =“mongodb:// myUser:password @ localhost / mydb /?authSource = admin”

您必须为生产数据库(在此示例中为myUser)和readWrite数据库提供mydb mocha个角色。