Para agentes de IA: um índice de documentação está disponível em https://www.mongodb.com/pt-br/docs/llms.txt — as versões de markdown de todas as páginas estão disponíveis anexando .md a qualquer caminho de URL.
Menu Docs

flushRouterConfig (comando de banco de dados)

flushRouterConfig

flushRouterConfig marks the cached routing table for a sharded cluster as stale, causing the next operation that requests the routing table to refresh the cache. Management of the routing table cache is generally handled automatically by the cluster. You should only need to run the flushRouterConfig command manually in specific instances, as indicated under Considerations.

Observação

Running flushRouterConfig is no longer required after executing the movePrimary or dropDatabase commands. These two commands now automatically refresh a sharded cluster's routing table as needed when run.

Esse comando está disponível em implantações hospedadas nos seguintes ambientes:

  • MongoDB Atlas: o serviço totalmente gerenciado para implantações do MongoDB na nuvem
  • MongoDB Enterprise: a versão autogerenciada e baseada em assinatura do MongoDB

  • MongoDB Community: uma versão com código disponível, de uso gratuito e autogerenciada do MongoDB

The flushRouterConfig is available on both mongos and mongod instances, and has the following syntax:

  • Liberar o cache para uma collection especificada quando passada em um parâmetro de namespace da collection:

    db.adminCommand(
    {
    flushRouterConfig: "<db.collection>"
    }
    )
  • Liberar o cache de um reconhecimento de data center especificado e todas as suas collection quando passado em um parâmetro de namespace do reconhecimento de data center:

    db.adminCommand(
    {
    flushRouterConfig: "<db>"
    }
    )
  • Limpar o cache para todos os reconhecimento de data center e suas collection ao executar sem um parâmetro ou passar em um valor escalar não string (por exemplo 1):

    db.adminCommand("flushRouterConfig")
    db.adminCommand(
    {
    flushRouterConfig: 1
    }
    )

Generally, a sharded cluster's routing table is automatically refreshed as needed as part of normal operation. However, you should manually issue the flushRouterConfig command before running the db.collection.getShardDistribution() command. This ensures that the command returns the most up-to-date information.