콘텐츠로 이동
한국어

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