Security fix
Fixes a read-only mode bypass in the aggregate tool. When the server was started with --read-only (or MCP_MONGODB_READONLY=true), an aggregation pipeline containing $out or $merge could still write to or replace collections, bypassing the read-only protection. Server-side JavaScript operators ($function, $accumulator, $where) are now rejected in read-only mode as well.
Affected: all versions up to and including 2.1.0 when run in read-only mode.
Fixed: aggregation pipelines are now recursively checked and these operators are rejected under read-only mode. Normal (writable) mode is unchanged.
For defense in depth, we also recommend enforcing read-only access at the database level with a read-only MongoDB user.
Full Changelog: 2.1.0...2.1.1