<!-- llms-explorer concept facts · https://llms-explorer.com/tree/inline-user-facing-querysettings-9-0/ · pack 2026-10-31 · ~1768 tokens -->

# Inline user-facing querySettings (9.0)

> Source-anchored research for Inline user-facing querySettings (9.0). Run status: COMPLETED.

Parent: [Operation rejection filters](https://llms-explorer.com/tree/operation-rejection-filters/) · 4 facets · 17 facts · page: https://llms-explorer.com/tree/inline-user-facing-querysettings-9-0/

## Structure and components

- The cached master QuerySettingsService interface forwards resolved query settings and their maxTimeMS together to shard requests. Its comment explains that forwarding settings alone could leave a shard computing its deadline from the stale client value. This is implementation context, not proof that every 9.0 patch contains this code. (low confidence) (verified as of 2026-10-27) — [source](https://github.com/mongodb/mongo/blob/master/src/mongo/db/query/query_settings/query_settings_service.h)

## How it works

- A concrete per-execution timeout form is db.runCommand({find:'users',filter:{status:'active'},querySettings:{maxTimeMS:5000}}). Inspect stored settings before relying on this value because stored settings take precedence. (medium confidence) (verified as of 2026-10-26) — [source](https://www.nosqlbooster.com/blog/announcing-nosqlbooster-11-2/)

## Problems, failure modes and limitations

- MongoDB combines inline querySettings with stored settings for the matching query shape. Stored settings take precedence when both specify the same field; callers cannot override a conflicting stored policy merely by supplying an inline value. (high confidence) (verified as of 2026-10-14) — [source](https://www.mongodb.com/docs/manual/release-notes/9.0.md)
- The VisuaLeaf author reports that an inline indexHints find succeeded on MongoDB 9.0.2 but failed with an unknown-field error on 8.2.5. The experiment used a local Docker instance with FCV 9.0 and does not establish sharded-secondary behavior. (low confidence) (verified as of 2026-10-09) — [source](https://visualeaf.com/blog/mongodb-9-0-whats-new/)
- In the cached master interface, applyMaxTimeMSFromSettings is a no-op during explain, and resolveMaxTimeMSForShardForwarding suppresses the settings timeout for explain while retaining its visibility in output. Explain therefore cannot by itself verify enforcement of that timeout. (low confidence) (verified as of 2026-10-27) — [source](https://github.com/mongodb/mongo/blob/master/src/mongo/db/query/query_settings/query_settings_service.h)

## Facts and statements

- Starting in MongoDB 9.0, external clients can supply querySettings directly on find, distinct, and aggregate. Settings apply only to that execution and are not stored or automatically applied to later queries with the same shape. (high confidence) (verified as of 2026-10-14) — [source](https://www.mongodb.com/docs/manual/release-notes/9.0.md)
- The presence of querySettings in older command IDL did not imply user support: SERVER-123044 describes its previous mongos-to-shard use and records the user-facing improvement as fixed in 9.0.0-rc0. (medium confidence) (verified as of 2026-09-28) — [source](https://jira.mongodb.org/browse/SERVER-123044)
- The queryKnobs and maxTimeMS query settings require FCV 9.0 or later. A 9.0 binary alone does not establish that these settings are enabled. (medium confidence) (verified as of 2026-10-26) — [source](https://www.mongodb.com/docs/manual/release-notes/9.0.md)
- For diagnosing a long-running read, per-execution settings permit a targeted index or tuning experiment without saving policy for every matching query shape. This is an operational inference from the execution scope and the independent client demonstrations, not a measured latency improvement. (medium confidence) — [source](https://www.mongodb.com/docs/manual/release-notes/9.0.md)
- Index hints in query settings restrict candidate indexes but do not guarantee index use; a collection scan can still win. VisuaLeaf's observed IXSCAN also retained FETCH and SORT, so command acceptance or index use alone does not demonstrate an efficient plan. (medium confidence) — [source](https://www.mongodb.com/docs/manual/reference/command/setquerysettings/)
- The aggregate command documents inline querySettings fields indexHints, queryFramework, reject, comment, queryKnobs, and maxTimeMS. The 9.0 queryKnobs and per-shape maxTimeMS additions require FCV 9.0 or later. (high confidence) (verified as of 2026-10-14) — [source](https://www.mongodb.com/docs/manual/reference/command/aggregate.md)
- For an isolated index experiment, use runCommand with querySettings.indexHints containing the target namespace and allowedIndexes, then inspect explain. VisuaLeaf reports that this form succeeded on 9.0.2 and failed as an unrecognized field on 8.2.5; its selected index still required FETCH and SORT and examined many more documents than it returned. (medium confidence) (verified as of 2026-10-09) — [source](https://visualeaf.com/blog/mongodb-9-0-whats-new/)
- Index hints in query settings restrict planner inputs but do not guarantee index use or efficient execution. MongoDB documents that a collection scan may still win; the independent VisuaLeaf experiment likewise warns that successful execution and confirmed index choice do not establish the best plan. (high confidence) — [source](https://www.mongodb.com/docs/manual/reference/command/setquerysettings/)
- A maxTimeMS stored with setQuerySettings takes precedence over command-level maxTimeMS and can cap or loosen the timeout for matching shapes. Setting the query-setting value to 0 clears that override and falls back to command-level and cluster-default timeout rules; it is not a universal instruction to disable every timeout. (medium confidence) (verified as of 2026-10-14) — [source](https://www.mongodb.com/docs/manual/reference/command/setquerysettings/)
- Inline querySettings should not be treated as a guarantee that a long-running secondary read survives orphan cleanup. This is a scope inference: the documented command fields control planning, rejection and execution settings, while the secondary-read documentation independently describes termination during cleanup after chunk migration. (medium confidence) — [source](https://www.mongodb.com/docs/manual/reference/command/aggregate.md)
- SERVER-130922 records a historical sharded timeout-precedence bug: a looser query-setting maxTimeMS could lose to the original tighter client deadline during shard-side majority/snapshot readConcern waits on a lagged secondary. The issue is marked Fixed in 9.0.0-rc3 and 9.1.0-rc0; do not present it as an established current 9.0 GA defect. (low confidence) (verified as of 2026-09-20) — [source](https://jira.mongodb.org/browse/SERVER-130922)
- NoSQLBooster announced per-command MongoDB 9.0 query-settings support in version 11.2, with runCommand examples and inline documentation. This is evidence about that client product, separate from server-side documentation and VisuaLeaf's independent local experiment. (low confidence) (verified as of 2026-10-26) — [source](https://www.nosqlbooster.com/blog/announcing-nosqlbooster-11-2/)
