27 IndexNotFound: Index not found
MongoDB의미
참조한 인덱스를 컬렉션에서 찾을 수 없다. 보통 존재하지 않는 인덱스를 삭제하거나 이름을 바꾸려 할 때 나타난다.
원인
dropIndex/hideIndex 같은 명령에 잘못된 인덱스 이름이나 키 지정을 주었거나, 인덱스가 이미 삭제되었거나, 자동 생성된 인덱스 이름이 예상과 다른 경우다(MongoDB는 field_1_field2_-1 같은 이름을 생성한다).
해결 방법
기존 인덱스와 정확한 이름 목록 확인: db.my_collection.getIndexes(). 올바른 이름이나 키 문서로 작업을 반복한다: db.my_collection.dropIndex({field: 1}) 또는 db.my_collection.dropIndex('field_1'). 삭제 스크립트는 인덱스가 없어도 실패하지 않도록 작성한다(존재 여부 확인).
같은 데이터베이스의 다른 항목
- 11601 InterruptedOperation was interrupted
- 85 IndexOptionsConflictIndex already exists with different options / different name (다른 옵션/이름의 인덱스가 이미 존재)
- 67 CannotCreateIndexCannot create index
- 79 UnknownReplWriteConcernUnknown replica set write concern
- 10107 NotWritablePrimarynot master / not writable primary
- 91 ShutdownInProgressThe server is in the process of shutting down (서버가 종료 중)
- 189 PrimarySteppedDownPrimary stepped down while operation was in progress (작업 진행 중 primary가 step down됨)