flushRouterConfig

  • flushRouterConfig
  • flushRouterConfig clears the cached routing table. Usethis command to force a refresh of the routing table cache. In mostcases, this happens automatically. You should only need to runflushRouterConfig after movePrimary hasbeen run or after manually clearing the jumbo chunk flag.

    • Starting in MongoDB 4.0.6 (and 3.6.11),flushRouterConfig is available on bothmongos instances and mongodinstances and can:

      • Flush the cache for a specified collection when passed in acollection namespace parameter:
  1. db.adminCommand({ flushRouterConfig: "<db.collection>" } )
  1. -

Flush the cache for a specified database and its collectionswhen passed in a database namespace parameter:

  1. db.adminCommand({ flushRouterConfig: "<db>" } )
  1. -

Flush the cache for all databases and their collections when runwithout a parameter or passed in a non-string scalar value (e.g. 1):

  1. db.adminCommand("flushRouterConfig")
  2. db.adminCommand( { flushRouterConfig: 1 } )
  • In MongoDB 4.0.5 and earlier (and 3.6.10 and earlier),flushRouterConfig is only available formongos instances and can flush the cache for alldatabases and their collections:
  1. db.adminCommand("flushRouterConfig")
  2. db.adminCommand( { flushRouterConfig: 1 } )

Considerations

You should only need to run flushRouterConfig aftermovePrimary has been run or after manually clearing thejumbo chunk flag.

See also