Navigation
This version of the documentation is archived and no longer supported.

flushRouterConfig

On this page

flushRouterConfig

flushRouterConfig clears 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 run flushRouterConfig after movePrimary has been run or after manually clearing the jumbo chunk flag.

  • Starting in MongoDB 4.0.6 (and 3.6.11), flushRouterConfig is available on both mongos instances and mongod instances 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 4.0.5 and earlier (and 3.6.10 and earlier), flushRouterConfig is only available for mongos instances 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.