Docs Menu
Docs Home
/
MongoDB Cluster-to-Cluster Sync
/ /

Migrate Persistent Query Settings

On this page

  • Steps
  • Export your Persistent Query Settings.
  • Import your PQS to the destination cluster.

If your source cluster uses Persistent Query Settings (PQS), you must manually migrate those settings to your destination cluster to finalize sync.

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

1

Run the following code block to output your query settings into an array:

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.

If the query setting includes a representativeQuery field value, use that field value as the setQuerySettings value.

Otherwise, use the queryShapeHash field value from the querySettings array as the setQuerySettings value.

Back

Finalize Cutover Process