28 PathNotViable: Cannot use the part of the path to traverse the element
MongoDBWhat does it mean?
An update tried to traverse a dotted field path (e.g. a.b.c), but part of the path hit a type that cannot contain subfields (a scalar value or an element of the wrong type). The path therefore could not be traversed.
Why does it happen?
Writing to a nested path such as a.b.c while field 'a' in the document is a scalar (e.g. number/string) rather than an object/array; or type mismatches such as finding an object where an array index is expected. Common in documents with an inconsistent schema (when updating deep paths with $set).
How to fix it
Before updating, make sure the path is of the expected type (object/array). Fix the incompatible documents or make the update conditional on the document structure. If needed, first convert the field to the correct type (e.g. replace the scalar value with an object), then write the nested field. Consider schema validation for schema consistency.
More from this engine
- 175 QueryPlanKilledQuery plan killed during execution
- 11602 InterruptedDueToReplStateChangeOperation interrupted due to a replication state change
- 136 CappedPositionLostCapped collection position lost
- 216 ElectionInProgressElectionInProgress
- 225 TransactionTooOldTransactionTooOld
- 246 SnapshotUnavailableSnapshotUnavailable
- 257 TransactionTooLargeTransactionTooLarge