61 — ShardKeyNotFound
shardingwrite
The shard key field is missing from the document
What is happening?
ShardKeyNotFound is returned when a document being inserted or updated in a sharded collection does not contain the shard key field, or the shard key field is set to null when the collection does not allow it. Every document in a sharded collection must include the shard key so MongoDB can route it to the correct shard.
Common causes
- Inserting a document without the shard key field
- Application code omitting the shard key in a document transformation
- ORM or driver not including the shard key field on insert
- Attempting to set the shard key field to null on a collection that disallows it