【发布时间】:2021-12-15 03:33:41
【问题描述】:
我在我的 node.js 项目中为 mongodb 使用 mongoose 库。在我的日志文件中收到 mongodb 错误消息:
{
message: 'Path collision at activity',
stack: 'MongoError: Path collision at activity\n' +
' at Connection.<anonymous> (/project/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:443:61)\n' +
' at Connection.emit (events.js:315:20)\n' +
' at Connection.EventEmitter.emit (domain.js:483:12)\n' +
' at processMessage (/project/node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:364:10)\n' +
' at Socket.<anonymous> (/project/node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:533:15)\n' +
' at Socket.emit (events.js:315:20)\n' +
' at Socket.EventEmitter.emit (domain.js:483:12)\n' +
' at addChunk (_stream_readable.js:295:12)\n' +
' at readableAddChunk (_stream_readable.js:271:9)\n' +
' at Socket.Readable.push (_stream_readable.js:212:10)\n' +
' at TCP.onStreamRead (internal/stream_base_commons.js:186:23)',
operationTime: Timestamp { _bsontype: 'Timestamp', low_: 2, high_: 1600849377 },
ok: 0,
errmsg: 'Path collision at activity',
code: 31250,
codeName: 'Location31250',
'$clusterTime': {
clusterTime: Timestamp { _bsontype: 'Timestamp', low_: 2, high_: 1600849377 },
signature: {
hash: Binary {
_bsontype: 'Binary',
sub_type: 0,
position: 20,
buffer: <Buffer d2 34 b7 ac bc a7 3f ea 38 d1 5c e3 26 58 39 43 d8 11 6c 83>
},
keyId: Long { _bsontype: 'Long', low_: 4, high_: 1596659428 }
}
},
name: 'MongoError',
level: 'info',
timestamp: '2020-09-23 08:22:57',
[Symbol(mongoErrorContextSymbol)]: {}
}
这个错误没有指向哪个函数返回这个错误的错误位置。 如果有人有任何线索,请告诉我。提前致谢。
【问题讨论】:
-
发送的查询是什么?
-
其实这是因为你写错了查询