对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。
Docs 菜单

迁移持久查询设置

如果源集群使用持久查询设置 (PQS),则必须手动将这些设置迁移到目标集群,才能完成同步。

mongosync checks for PQS during initialization and the cutover process. If mongosync finds PQS on the source cluster during cutover, Mongosync shows a warning. Use the following procedure to address the warning and migrate your PQS to your destination cluster.

1

运行以下代码区块,将查询设置输出到大量中:

mongosh --eval
'console.log(db.aggregate([{$querySettings:{}}]).toArray())'
2

For each query setting that you want to migrate, use setQuerySettings to apply that setting to your destination cluster.

如果查询设置包含 representativeQuery字段值,则使用该字段值作为 setQuerySettings 值。

否则,使用 querySettings大量中的 queryShapeHash字段值作为 setQuerySettings 值。