Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Mongodb Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-mongodb-knowledge-patch)
---
name: mongodb-knowledge-patch
description: MongoDB
version: "9.0.8"
license: MIT
metadata:
author: Nevaberry
---
# MongoDB compatibility and operations
Load this skill for MongoDB upgrade compatibility, encrypted queries, query
settings, sharding, storage configuration, and diagnostics. Use the topic
references for complete conditions, examples, and version-specific behavior.
## Reference index
| Reference | Topics |
| --- | --- |
| [Compatibility, upgrades, and known issues](references/compatibility-upgrades-and-known-issues.md) | FCV, downgrades, index compatibility, startup failures, upgrade configuration, recovery, archive paths |
| [Encryption, validation, and Stable API](references/encryption-validation-and-stable-api.md) | Encrypted string queries, encryption libraries, X.509, BSON, collection validators, geospatial errors, Stable API |
| [Aggregation, queries, and search](references/aggregation-queries-and-search.md) | Query memory, query settings, aggregation, server-side JavaScript, search on views, time series commands |
| [Sharding, replication, and networking](references/sharding-replication-and-networking.md) | Orphan cleanup, shard key indexes, metadata checks, mirrored reads, initial sync, connection limits |
| [Storage, configuration, and observability](references/storage-configuration-and-observability.md) | WiredTiger, transactions, sessions, query statistics, audit addresses, change streams, server status |
## Upgrade compatibility and deprecations
### FCV and downgrade restrictions
Upgrading from 8.0 to 8.2 requires FCV `8.0`. Downgrades are limited to one
release step, and FCV cannot be downgraded to or from a minor release.
Community Edition binary downgrades are unsupported. Enterprise binary
downgrades after an FCV change require support assistance.
### BSON ingestion and server-side JavaScript
The server validates all incoming BSON objects by default and rejects invalid
data. `net.wireObjectCheck` and its corresponding CLI flags are deprecated.
`$accumulator`, `$function`, and `$where` come out of deprecation and run on a
WebAssembly-based engine. Server-side JavaScript support excludes `ppc64le`.
### Automatic encryption query analysis
`mongocryptd` is deprecated in 9.0. Use the Automatic Encryption Shared Library
for automatic encryption query analysis.
In 8.2.4 and 8.2.5, `mongocryptd` messages are capped at 16 KiB, which can break
larger commands using automatic Client-Side Field Level Encryption or Queryable
Encryption. Skip those versions for `mongocryptd` or use `crypt_shared`.
### Secondary read errors and shard key indexes
`terminateSecondaryReadsOnOrphanCleanup` defaults to `true`. A secondary read
that started before a chunk migration committed can be terminated before
orphaned documents are deleted, so clients must handle a read error.
`orphanCleanupDelaySecs` defaults to `3600`, up from `900`.
8.2.2 disallows compound wildcard indexes as shard key indexes.
### Index compatibility
Geospatial index generation uses GeoJSON when both GeoJSON and legacy numeric
coordinates are present. Rebuild affected indexes if queries rely on legacy
coordinates that appeared first.
At FCV 9.0, `listIndexes` reports `collation: { locale: "simple" }` for
simple-collation indexes, which can cause Mongoose `syncIndexes()` to rebuild
unchanged indexes. Upgrade Mongoose to 9.10.4 or 8.24.5 on the corresponding
release line, or replace startup `syncIndexes()` calls with `createIndexes()`
and run index synchronization as an explicit deployment step.
### Sharded cluster and time series upgrades
Before upgrading a sharded cluster with dedicated config servers to an affected
9.0 release, set `ShardingTaskExecutorPoolMinSizeForConfigServers` to `1` if
`ShardingTaskExecutorPoolMinSize` exceeds `1`. For embedded config servers,
obtain deployment-specific configuration guidance from support.
A database with more than 5,000 time series collections can prolong a 9.0
upgrade and cause write latency spikes. Drop unused time series collections
before upgrading to reduce the impact.
### Startup and recovery issues
- In 8.2.0, `mongocryptd`, `mongod`, and `mongos` fail to start on Windows with
`--logpath NUL`. If the .NET/C# driver launches `mongocryptd` with default
arguments, configure a file log path or switch to the Automatic Encryption
Shared Library.
- 8.2 binaries can crash at startup on Linux kernel 6.19 due to a TCMalloc
incompatibility, including in container deployments on that kernel.
- In 9.0.0 through 9.0.2, an interrupted chunk operation can block recovery
during shard step-up and make the shard unavailable for primary reads and
writes. Restart the hung node to let another member become primary, and
upgrade to 9.0.4 for the fix.
- On affected 9.0 versions, an unclean shutdown followed by file-copy initial
sync can put a node in a crash loop. On self-managed deployments, restart the
affected node with `initialSyncMethod` set to `logical` to complete initial sync.
- In 9.0.8, cross-compiled archive directory names use the target architecture.
Scripts constructing paths into these archives should use that architecture.
## Query limits and settings
### Memory and disk failures
By default, a query exceeding the greater of 1 GB or 20% of the memory available
to the server process fails with `ExceededMemoryLimit` or
`QueryExceededMemoryLimitNoDiskUseAllowed`.
Set `internalQueryMaxMemoryUsageBytesPerOperation` at startup, at runtime, or
through query settings to change the query limit.
Use `internalQueryMaxSingleExpressionMemoryUsageBytes` at startup or runtime
to change the separate 100 MB limit per expression evaluation.
Starting in 8.1 and 8.0.5, queries that spill to disk fail when free disk space
is low. Starting in 8.2.8, `chars` for `$trim`, `$ltrim`, and `$rtrim` is limited
to 4096 characters.
### Per-command and per-shape settings
Pass `querySettings` to `find`, `distinct`, or `aggregate` for one execution.
The server merges these with stored settings for the query shape, giving
stored values precedence for conflicting fields.
At FCV 9.0 or later, `settings.maxTimeMS` in `setQuerySettings` imposes a time
limit on a query shape:
```javascript
db.adminCommand({
setQuerySettings: { find: "orders", filter: { status: "open" }, $db: "shop" },
settings: { maxTimeMS: 1000 }
})
```
At FCV 9.0 or later, `queryKnobs` overrides supported internal server
parameters for a query shape.
## Encryption and validation
### Encrypted string query availability
The 8.2 preview supports prefix, suffix, and substring queries on encrypted
string fields. Use them only outside production and plan to drop affected
collections before adopting the generally available feature. For `mongosh`,
install Automatic Encryption Shared Library 8.2 or later separately and pass
its path with `--cryptSharedLibPath`.
These Queryable Encryption queries are generally available in 9.0. Using them
in `mongosh` requires Automatic Encryption Shared Library 9.0 or later.
The 8.1 changes allow `$lookup` to reference multiple encrypted collections.
### Collection constraints and logged validation errors
`validationLevel: "constraint"` applies the validator to all inserts and
updates and guarantees that every document in the collection satisfies it:
```javascript
db.createCollection("orders", {
validator: { total: { $gte: 0 } },
validationLevel: "constraint"
})
```
Use `validationAction: "errorAndLog"`, introduced in 8.1, to reject invalid
writes and record the errors in the `mongod` log.
## Aggregation and search
`aggregate()` can use `$currentDate` to return the server's current time.
Use `$listClusterCatalog`, introduced in 8.1, to inspect the cluster catalog.
Starting in 8.1, `createSearchIndexes`, `updateSearchIndex`, `dropSearchIndex`,
and `$listSearchIndexes` work on standard views whose pipelines use only
`$addFields`, `$set`, or `$match` wrapping `$expr`.
A suitably indexed view supports `$search` and `$searchMeta` with a search
index or `$vectorSearch` with a vector search index.
On time series collections, `find`, `aggregate`, and `listIndexes` return the
user-facing namespace in `cursor.ns`; `renameCollection` supports time series
collections.
## Resource and connection configuration
### Storage, transactions, and sessions
Use `storage.wiredTiger.engineConfig.cacheSizePct` to size the internal cache
as a percentage of available memory, or pass `mongod --wiredTigerCacheSizePct 40`.
`storage.wiredTiger.engineConfig.zstdCompressionLevel` accepts `-7` to `22`;
negative levels favor compression and decompression speed over compression ratio.
`maxConcurrentMultiDocumentTransactions` defaults to 10,000 open multi-document
transactions for external clients. At the limit, attempts to start another
transaction return `TooManyOpenTransactions`.
Starting in 9.0.1, `sessionCatalogPartitions` controls the number of session
catalog partitions for deployments with many concurrent sessions.
### Connection establishment limiting
Enable the limiter and set the establishment rate, burst allowance, and queue depth:
```yaml
setParameter:
ingressConnectionEstablishmentRateLimiterEnabled: true
ingressConnectionEstablishmentRatePerSec: 100
ingressConnectionEstablishmentBurstCapacitySecs: 1
ingressConnectionEstablishmentMaxQueueDepth: 100
```
Monitor the queue and rejections in `serverStatus` under
`connections.queuedForEstablishment` and `connections.establishmentRateLimit`.
## Observability compatibility
`$queryStats` collects statistics for `insert`, `update`, and `delete` and
samples reads and writes by default. `internalQueryStatsSampleRate` for reads
and `internalQueryStatsWriteCmdSampleRate` for writes both default to `0.01` (1%).
Update consumers to read cursor and batch data from `metrics.cursor`, execution
data from `metrics.queryExec`, planner data from `metrics.queryPlanner`, and
write data from `metrics.writes`.
Read `metrics.changeStreams.option.showExpandedEvents` in place of
`metrics.changeStreams.showExpandedEvents`. The
`shardingStatistics.databaseVersionUpdateCounters` document moves to
`shardingStatistics.databaseShardingMetadataStatistics` with a new set of fields.
For an audited session's literal TCP peer address, read `directRemote` in the
`mongo` audit schema or `direct_endpoint` in OCSF. These fields are independent
of any client address asserted in a PROXY protocol header.