Docs Menu
Docs Home
/ / /
PyMongo Driver
/

Compatibility

The following compatibility table specifies the recommended version or versions of PyMongo for use with a specific version of MongoDB.

The first column lists the driver version.

Important

v4.4 End of Life

v4.4 reached end of life on February 29, 2024 and is no longer supported by MongoDB.

Platform
Architecture
Edition
8.0
7.0
6.0
5.0
4.4

Amazon Linux 2023

x86_64

Enterprise

Amazon Linux 2023

x86_64

Community

Amazon Linux V2

x86_64

Enterprise

Amazon Linux V2

x86_64

Community

Debian 12

x86_64

Enterprise

Debian 12

x86_64

Community

Debian 11

x86_64

Enterprise

5.0.8+

Debian 11

x86_64

Community

5.0.8+

Debian 10

x86_64

Enterprise

Debian 10

x86_64

Community

Debian 9

x86_64

Enterprise

Debian 9

x86_64

Community

RHEL/Rocky/Alma/Oracle Linux 9.0+ [2]

x86_64

Enterprise

6.0.4+

RHEL/Rocky/Alma/Oracle Linux 9.0+ [2]

x86_64

Community

6.0.4+

RHEL/Rocky/Alma/Oracle Linux 8.0+ [2]

x86_64

Enterprise

RHEL/Rocky/Alma/Oracle Linux 8.0+ [2]

x86_64

Community

RHEL/CentOS/Oracle Linux 7.0+ [2]

x86_64

Enterprise

RHEL/CentOS/Oracle Linux 7.0+ [2]

x86_64

Community

RHEL/CentOS/Oracle Linux 6.2+ [2]

x86_64

Enterprise

RHEL/CentOS/Oracle Linux 6.2+ [2]

x86_64

Community

SLES 15

x86_64

Enterprise

SLES 15

x86_64

Community

SLES 12

x86_64

Enterprise

SLES 12

x86_64

Community

Ubuntu 24.04

x86_64

Enterprise

Ubuntu 24.04

x86_64

Community

Ubuntu 22.04

x86_64

Enterprise

6.0.4+

Ubuntu 22.04

x86_64

Community

6.0.4+

Ubuntu 20.04

x86_64

Enterprise

Ubuntu 20.04

x86_64

Community

Ubuntu 18.04

x86_64

Enterprise

Ubuntu 18.04

x86_64

Community

Ubuntu 16.04

x86_64

Enterprise

Ubuntu 16.04

x86_64

Community

Windows 11

x86_64

Enterprise

Windows 11

x86_64

Community

Windows Server 2022

x86_64

Enterprise

Windows Server 2022

x86_64

Community

Windows Server 2019

x86_64

Enterprise

Windows Server 2019

x86_64

Community

Windows 10 / Server 2016

x86_64

Enterprise

Windows 10 / Server 2016

x86_64

Community

macOS14

x86_64

Enterprise

macOS14

x86_64

Community

macOS 13

x86_64

Enterprise

macOS 13

x86_64

Community

macOS 12

x86_64

Enterprise

macOS 12

x86_64

Community

macOS 11

x86_64

Enterprise

macOS 11

x86_64

Community

macOS 10.15

x86_64

Enterprise

macOS 10.15

x86_64

Community

macOS 10.14

x86_64

Enterprise

macOS 10.14

x86_64

Community

macOS 10.13

x86_64

Enterprise

macOS 10.13

x86_64

Community

macOS 14

arm64

Enterprise

macOS 14

arm64

Community

macOS 13

arm64

Enterprise

macOS 13

arm64

Community

macOS 12

arm64

Enterprise

macOS 12

arm64

Community

macOS 11

arm64

Enterprise

macOS 11

arm64

Community

Amazon Linux 2023

arm64

Enterprise

Amazon Linux 2023

arm64

Community

Amazon Linux 2

arm64

Enterprise

4.4.4+

Amazon Linux 2

arm64

Community

4.4.4+

RHEL/CentOS/Rocky/Alma 9

arm64

Enterprise

RHEL/CentOS/Rocky/Alma 9

arm64

Community

RHEL/CentOS/Rocky/Alma 8

arm64

Enterprise

4.4.4+

RHEL/CentOS/Rocky/Alma 8

arm64

Community

4.4.4+

Ubuntu 24.04

arm64

Enterprise

Ubuntu 24.04

arm64

Community

Ubuntu 22.04

arm64

Enterprise

6.0.4+

Ubuntu 22.04

arm64

Community

6.0.4+

Ubuntu 20.04

arm64

Enterprise

Ubuntu 20.04

arm64

Community

Ubuntu 18.04

arm64

Enterprise

Ubuntu 18.04

arm64

Community

Ubuntu 16.04

arm64

Enterprise

RHEL/Rocky/Alma 9

ppc64le

Enterprise

RHEL/Rocky/Alma 8

ppc64le

Enterprise

RHEL/CentOS 7

ppc64le

Enterprise

6.0.7+

RHEL/Rocky/Alma 9

s390x

Enterprise

RHEL/Rocky/Alma 8

s390x

Enterprise

5.0.9+

RHEL/CentOS 7

s390x

Enterprise

RHEL/CentOS 7

s390x

Community

[2](1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) On Oracle Linux, MongoDB only supports the Red Hat Compatible Kernel.

Important

v4.4 End of Life

v4.4 reached end of life on February 29, 2024 and is no longer supported by MongoDB.

Platform
Architecture
Edition
8.0
7.0
6.0
5.0
4.4

Amazon Linux 2023

x86_64

Enterprise

Amazon Linux 2023

x86_64

Community

Amazon Linux V2

x86_64

Enterprise

Amazon Linux V2

x86_64

Community

Debian 12

x86_64

Enterprise

Debian 12

x86_64

Community

Debian 11

x86_64

Enterprise

5.0.8+

Debian 11

x86_64

Community

5.0.8+

Debian 10

x86_64

Enterprise

Debian 10

x86_64

Community

Debian 9

x86_64

Enterprise

Debian 9

x86_64

Community

RHEL/Rocky/Alma/Oracle Linux 9.0+ [2]

x86_64

Enterprise

6.0.4+

RHEL/Rocky/Alma/Oracle Linux 9.0+ [2]

x86_64

Community

6.0.4+

RHEL/Rocky/Alma/Oracle Linux 8.0+ [2]

x86_64

Enterprise

RHEL/Rocky/Alma/Oracle Linux 8.0+ [2]

x86_64

Community

RHEL/CentOS/Oracle Linux 7.0+ [2]

x86_64

Enterprise

RHEL/CentOS/Oracle Linux 7.0+ [2]

x86_64

Community

RHEL/CentOS/Oracle Linux 6.2+ [2]

x86_64

Enterprise

RHEL/CentOS/Oracle Linux 6.2+ [2]

x86_64

Community

SLES 15

x86_64

Enterprise

SLES 15

x86_64

Community

SLES 12

x86_64

Enterprise

SLES 12

x86_64

Community

Ubuntu 24.04

x86_64

Enterprise

Ubuntu 24.04

x86_64

Community

Ubuntu 22.04

x86_64

Enterprise

6.0.4+

Ubuntu 22.04

x86_64

Community

6.0.4+

Ubuntu 20.04

x86_64

Enterprise

Ubuntu 20.04

x86_64

Community

Ubuntu 18.04

x86_64

Enterprise

Ubuntu 18.04

x86_64

Community

Ubuntu 16.04

x86_64

Enterprise

Ubuntu 16.04

x86_64

Community

Windows 11

x86_64

Enterprise

Windows 11

x86_64

Community

Windows Server 2022

x86_64

Enterprise

Windows Server 2022

x86_64

Community

Windows Server 2019

x86_64

Enterprise

Windows Server 2019

x86_64

Community

Windows 10 / Server 2016

x86_64

Enterprise

Windows 10 / Server 2016

x86_64

Community

macOS14

x86_64

Enterprise

macOS14

x86_64

Community

macOS 13

x86_64

Enterprise

macOS 13

x86_64

Community

macOS 12

x86_64

Enterprise

macOS 12

x86_64

Community

macOS 11

x86_64

Enterprise

macOS 11

x86_64

Community

macOS 10.15

x86_64

Enterprise

macOS 10.15

x86_64

Community

macOS 10.14

x86_64

Enterprise

macOS 10.14

x86_64

Community

macOS 10.13

x86_64

Enterprise

macOS 10.13

x86_64

Community

macOS 14

arm64

Enterprise

macOS 14

arm64

Community

macOS 13

arm64

Enterprise

macOS 13

arm64

Community

macOS 12

arm64

Enterprise

macOS 12

arm64

Community

macOS 11

arm64

Enterprise

macOS 11

arm64

Community

Amazon Linux 2023

arm64

Enterprise

Amazon Linux 2023

arm64

Community

Amazon Linux 2

arm64

Enterprise

4.4.4+

Amazon Linux 2

arm64

Community

4.4.4+

RHEL/CentOS/Rocky/Alma 9

arm64

Enterprise

RHEL/CentOS/Rocky/Alma 9

arm64

Community

RHEL/CentOS/Rocky/Alma 8

arm64

Enterprise

4.4.4+

RHEL/CentOS/Rocky/Alma 8

arm64

Community

4.4.4+

Ubuntu 24.04

arm64

Enterprise

Ubuntu 24.04

arm64

Community

Ubuntu 22.04

arm64

Enterprise

6.0.4+

Ubuntu 22.04

arm64

Community

6.0.4+

Ubuntu 20.04

arm64

Enterprise

Ubuntu 20.04

arm64

Community

Ubuntu 18.04

arm64

Enterprise

Ubuntu 18.04

arm64

Community

Ubuntu 16.04

arm64

Enterprise

RHEL/Rocky/Alma 9

ppc64le

Enterprise

RHEL/Rocky/Alma 8

ppc64le

Enterprise

RHEL/CentOS 7

ppc64le

Enterprise

6.0.7+

RHEL/Rocky/Alma 9

s390x

Enterprise

RHEL/Rocky/Alma 8

s390x

Enterprise

5.0.9+

RHEL/CentOS 7

s390x

Enterprise

RHEL/CentOS 7

s390x

Community

[2](1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) On Oracle Linux, MongoDB only supports the Red Hat Compatible Kernel.
PyMongo Version
MongoDB 8.0
MongoDB 7.0
MongoDB 6.0
MongoDB 5.0
MongoDB 4.4
MongoDB 4.2
MongoDB 4.0
MongoDB 3.6

4.13

✓

✓

✓

✓

✓

✓

4.11 to 4.12

✓

✓

✓

✓

✓

✓

✓

4.9 to 4.10

✓

✓

✓

✓

✓

✓

✓

✓

4.4 to 4.8

⊛

✓

✓

✓

✓

✓

✓

✓

4.2 to 4.3

⊛

⊛

✓

✓

✓

✓

✓

✓

3.12 to 4.1

⊛

⊛

⊛

✓

✓

✓

✓

✓

3.11

⊛

⊛

⊛

⊛

✓

✓

✓

✓

3.9 to 3.10

⊛

⊛

⊛

⊛

⊛

✓

✓

✓

3.7 to 3.8

⊛

⊛

⊛

⊛

⊛

⊛

✓

✓

PyMongo supports both CPython and PyPy.

When a version of Python is marked end-of-life (EOL), the next minor release of PyMongo drops support for that version. The driver offers the following ongoing support for EOL Python versions:

  • CPython: The last minor PyMongo version compatible with the EOL CPython version receives critical bug fixes for one year.

  • PyPy: PyMongo doesn't support PyPy versions past their EOL date.

The following compatibility table specifies the recommended version of PyMongo for use with a specific version of Python. The first column lists the driver version.

The following compatibility tables show PyMongo's compatibility with different versions of CPython and PyPy.

For more information about how to read the compatibility tables, see MongoDB Compatibility Tables.

PyMongo Version
CPython 3.13
CPython 3.12
CPython 3.11
CPython 3.10 [3]
CPython 3.9
CPython 3.8
CPython 3.7
CPython 3.6
CPython 3.5
CPython 3.4

4.11 to 4.13

✓

✓

✓

✓

✓

4.9 to 4.10

✓

✓

✓

✓

✓

✓

4.8

✓

✓

✓

✓

✓

4.5 to 4.7

✓

✓

✓

✓

✓

✓

4.3 to 4.4

✓

✓

✓

✓

✓

4.2

✓

✓

✓

✓

4.1 [4]

✓

✓

✓

✓

✓

4.0

✓

✓

✓

✓

✓

3.13

✓

✓

✓

✓

✓

✓

✓

✓

3.12

✓

✓

✓

✓

✓

✓

✓

3.11

✓

✓

✓

✓

✓

✓

3.10

✓

✓

✓

✓

✓

3.7 to 3.9

✓

✓

✓

✓

PyMongo Version
PyPy3.10
PyPy3.9
PyPy3.8
PyPy3.7
PyPy3.6
PyPy3.5

4.11 to 4.13

✓

4.8 to 4.10

✓

✓

4.5 to 4.7

✓

✓

✓

4.2 to 4.4

✓

✓

✓

✓

4.1 [4]

✓

✓

✓

✓

✓

4.0

✓

✓

✓

✓

✓

3.12

✓

✓

✓

✓

✓

✓

3.11

✓

✓

✓

✓

✓

3.10

✓

✓

✓

✓

3.7 to 3.9

✓

✓

✓

[3] Versions of Python 3.10 and later are not compatible with TLS/SSL for versions of MongoDB 4.0 and earlier. For more information, see the TLS section of the Troubleshooting guide.
[4](1, 2) PyMongo 4.1 requires Python 3.6.2 or later.

PyMongo versions 3.7 through 3.12 are compatible with Python 2.7 and PyPy2.7. However, in some cases, PyMongo applications behave differently when running in a Python 2 environment.

The following sections describe the differences in behavior between Python 2 and Python 3 when using PyMongo.

In all versions of Python, PyMongo encodes instances of the bytes class as binary data with subtype 0, the default subtype for binary data. In Python 3, PyMongo decodes these values to instances of the bytes class. In Python 2, the driver decodes them to instances of the Binary class with subtype 0.

The following code examples show how PyMongo decodes instances of the bytes class. Select the Python 2 or Python 3 tab to view the corresponding code.

from pymongo import MongoClient
client = MongoClient()
client.test.test.insert_one({'binary': b'this is a byte string'})
doc = client.test.test.find_one()
print(doc)
{u'_id': ObjectId('67afb78298f604a28f0247b4'), u'binary': Binary('this is a byte string', 0)}
from pymongo import MongoClient
client = MongoClient()
client.test.test.insert_one({'binary': b'this is a byte string'})
doc = client.test.test.find_one()
print(doc)
{'_id': ObjectId('67afb78298f604a28f0247b4'), 'binary': b'this is a byte string'}

The driver behaves the same way when decoding JSON binary values with subtype 0. In Python 3, it decodes these values to instances of the bytes class. In Python 2, the driver decodes them to instances of the Binary class with subtype 0. For code examples that show the differences, see the Extended JSON page.

If you pickled an ObjectId in Python 2 and want to unpickle it in Python 3, you must pass encoding='latin-1' as an argument to the pickle.loads() method.

The following example shows how to use Python 3 to unpickle an ObjectId that was pickled in Python 2:

import pickle
pickle.loads(b'<ObjectId byte stream>', encoding='latin-1')

If a Python 3 application uses a compatible serialization protocol to pickle an ObjectId, you can use Python 2 to unpickle it. To specify a compatible protocol in Python 3, pass a value of 0, 1, or 2 for the protocol parameter of the pickle.dumps() method.

The following example pickles an ObjectId in Python 3, then prints the ObjectId and resulting bytes instance:

import pickle
from bson.objectid import ObjectId
oid = ObjectId()
oid_bytes = pickle.dumps(oid, protocol=2)
print("ObjectId: {}".format(oid))
print("ObjectId bytes: {}".format(oid_bytes))
ObjectId: 67af9b1fae9260c0e97eb9eb
ObjectId bytes: b'\x80\x02cbson.objectid\nObjectId\nq\x00...

The following example unpickles the ObjectId from the previous example, and then prints the bytes and ObjectId instances:

import pickle
from bson.objectid import ObjectId
oid_bytes = b'\x80\x02cbson.objectid\nObjectId\nq\x00...'
oid = pickle.loads(oid_bytes)
print("ObjectId bytes: {}".format(oid_bytes))
print("ObjectId: {}".format(oid))
ObjectId bytes: b'\x80\x02cbson.objectid\nObjectId\nq\x00)...
ObjectId: 67af9b1fae9260c0e97eb9eb

The following table shows the equivalent versions of Motor and PyMongo.

Motor Version
PyMongo Version

3.7

4.10

3.6

4.9

3.3

4.4

3.1

4.2

3.0

4.0

Back

Release Notes

On this page