从firebase函数连接到mongodb地图集时,我随机遇到以下错误。知道是什么原因造成的(似乎无需任何干预即可自动修复)?
{
MongoError: command aggregate requires authentication
at queryCallback (/user_code/node_modules/mongoose/node_modules/mongodb-core/lib/cursor.js:248:25)
at /user_code/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:532:18
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickDomainCallback (internal/process/next_tick.js:128:9)
operationTime: Timestamp { _bsontype: 'Timestamp', low_: 1, high_: 1540073032 },
ok: 0,
errmsg: 'command aggregate requires authentication',
code: 13,
codeName: 'Unauthorized',
'$clusterTime':
{ clusterTime: Timestamp { _bsontype: 'Timestamp', low_: 1, high_: 1540073032 },
signature: { hash: [Object], keyId: [Object] } },
name: 'MongoError'
}
答案 0 :(得分:0)
我正面临着类似的事情。原来,当我使用隧道在本地运行代码时,它无法在服务器上运行。因此,这是一个愚蠢的错误。检查是否没有其他mongodb实例在使用中。