我刚刚开始使用排序规则选项对我的db.createCollection调用产生这个奇怪的问题。虽然我的代码库中的这一部分已经运行多年,没有被触及,但它现在已经失败了。我刚刚注意到,在删除排序规则选项时,db.createCollection会成功。但是对于这些集合来说,排序规则选项是至关重要的。
我正在使用以下电话:
db.createCollection(collectionName, {
collation: {
locale: 'en_US',
strength: 2
}
});并得到这个错误:
MongoError: BSON field 'listCollections.collation' is an unknown field.
at MessageStream.messageHandler (C:\projectsjs\fourmatic\node_modules\mongodb\lib\cmap\connection.js:261:20)
at MessageStream.emit (events.js:209:13)
at MessageStream.EventEmitter.emit (domain.js:476:20)
at processIncomingData (C:\projectsjs\fourmatic\node_modules\mongodb\lib\cmap\message_stream.js:144:12)
at MessageStream._write (C:\projectsjs\fourmatic\node_modules\mongodb\lib\cmap\message_stream.js:42:5)
at doWrite (_stream_writable.js:428:12)
at writeOrBuffer (_stream_writable.js:412:5)
at MessageStream.Writable.write (_stream_writable.js:302:11)
at TLSSocket.ondata (_stream_readable.js:722:22)
at TLSSocket.emit (events.js:209:13) {
ok: 0,
code: 40415,
codeName: 'Location40415',
'$clusterTime': {
clusterTime: Timestamp { _bsontype: 'Timestamp', low_: 3, high_: 1647996433 },
signature: { hash: [Binary], keyId: [Long] }
},
operationTime: Timestamp { _bsontype: 'Timestamp', low_: 3, high_: 1647996433 },
name: 'MongoError'
}有谁能让我知道为什么这个问题突然出现在校对选项上?
发布于 2022-03-25 18:01:44
迁移到最新版本的MongoDB NodeJS驱动程序纠正了这个问题。我假设最近在阿特拉斯云服务器或MongoDB引擎中发生了某些破坏。
https://stackoverflow.com/questions/71596131
复制相似问题