Перейти к содержимому
Русский

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.

unknown

boolean