unstale

pypi / pymongo

pymongo

What changed in pymongo 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-22.

3 breaking4 security2 deprecations1 new APIs and options3 performance3 behavior and defaults3 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.2.2 on npm

pymongo 419 changes

Breaking changes 3

Security 4

Deprecations 2

  • PyPy support is deprecated and will be removed in a future release.

    4.18.0release notes

  • Python 2 methods in SON are deprecated.

    4.17.0release notes

New APIs and options 1

  • Added as a URI option and MongoClient keyword argument; for mongodb+srv:// connections, it allows SRV-returned hosts under a different domain suffix, provided the suffix is not a public suffix.

    4.18.0release notes

Performance 3

  • Improved MongoDB 9.0’s IWM performance by retrying overload errors only when doing so is not expected to worsen server conditions.

    4.18.0release notes

  • TLS sessions are reused across connections to the same server to improve connection performance.

    4.18.0release notes

  • BSON encoding and decoding performance improvements may benefit applications that process BSON data.

    4.17.0release notes

Behavior and default changes 3

  • General availability support was added for prefix, suffix, and substring queries against MongoDB 9.0+; requires libmongocrypt 1.20.0 or later.

    4.18.0release notes

  • Simple collation is now included in index information.

    4.17.0release notes

  • The callback type now accepts the broader Awaitable type rather than only Coroutine objects.

    4.15.4release notes

Fixes and other changes 3

  • Added support for MongoDB 9.0.

    4.18.0release notes

  • The sessions API was improved; the notes do not specify the details.

    4.17.0release notes

  • Fixes a bug that could cause AutoReconnect("connection pool paused") errors when cursors fetched more documents after SDAM heartbeat failures.

    4.15.5release notes