334 — MechanismUnavailable
sharding
The database routing metadata is stale
What is happening?
StaleDbVersion is returned when a shard receives a command with a database version that does not match its current knowledge. This occurs after movePrimary operations, database creation on a different shard, or when the config server metadata changes. The driver or mongos normally retries transparently after refreshing the routing table.
Common causes
- movePrimary was recently executed for the database
- Database was dropped and recreated while operations were in-flight
- Config server metadata updated but the shard's cache is stale
- Multiple mongos instances with different cached database versions