isMongoDuplicateKeyError
此内容尚不支持你的语言。
isMongoDuplicateKeyError(
error):boolean
Defined in: src/persistence/journals/MongoClient.ts:143
MongoDB duplicate-key error — server code 11000.
This is the MongoDB analogue of SQLSTATE 23505, and it is what makes the
journal’s optimistic concurrency sound: the unique compound index on
(persistenceId, sequenceNr) rejects a racing writer, and this predicate
turns that rejection into a JournalConcurrencyError.
A failed insertMany arrives as a bulk-write error whose per-document
writeErrors carry the code, so those are checked too.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
