67 CannotCreateIndex: Cannot create index
MongoDBWhat does it mean?
The index build failed because of a constraint or limit. MongoDB could not build the requested index due to existing data or configuration.
Why does it happen?
Exceeding the maximum number of indexes allowed per collection (64); a key that is too large; or incompatible option combinations (e.g. an unsuitable field type for a TTL index). Note: building a unique index while the existing data contains duplicates raises E11000 DuplicateKey, not this code.
How to fix it
If you hit the index count limit, drop unused indexes (analyze usage with $indexStats). Check key size/type compatibility and the option combination. On large collections, build the index during low load (since 4.2 index builds do not block writes for long anyway; the background option is ignored).
More from this engine
- 48 NamespaceExistsNamespace (collection) already exists
- 11601 InterruptedOperation was interrupted
- 85 IndexOptionsConflictIndex already exists with different options / different name
- 27 IndexNotFoundIndex not found
- 79 UnknownReplWriteConcernUnknown replica set write concern
- 10107 NotWritablePrimarynot master / not writable primary
- 91 ShutdownInProgressThe server is in the process of shutting down