On this page
flushRouterConfig
On this page
flushRouterConfig-
flushRouterConfigclears the cached routing table. Use this command to force a refresh of the routing table cache. In most cases, this happens automatically. You should only need to runflushRouterConfigaftermovePrimaryhas been run or after manually clearing thejumbochunk flag.Starting in MongoDB 3.6.11,
flushRouterConfigis available on bothmongosinstances andmongodinstances and can:Flush the cache for a specified collection when passed in a collection namespace parameter:
db.adminCommand({ flushRouterConfig: "<db.collection>" } )Flush the cache for a specified database and its collections when passed in a database namespace parameter:
db.adminCommand({ flushRouterConfig: "<db>" } )Flush the cache for all databases and their collections when run without a parameter or passed in a non-string scalar value (e.g.
1):db.adminCommand("flushRouterConfig") db.adminCommand( { flushRouterConfig: 1 } )
In MongoDB 3.6.10 and earlier,
flushRouterConfigis only available formongosinstances and can flush the cache for all databases and their collections:db.adminCommand("flushRouterConfig") db.adminCommand( { flushRouterConfig: 1 } )
Considerations
You should only need to run flushRouterConfig after movePrimary has been run or after manually clearing the jumbo chunk flag.