A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.mongodb.com/docs/languages/python/pymongo-driver/current/reference/compatibility/ below:

Compatibility - PyMongo Driver v4.13

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

MongoDB ensures compatibility between the MongoDB Server and the drivers for three years after the server version's end of life (EOL) date. To learn more about the MongoDB release and EOL dates, see MongoDB Software Lifecycle Schedules.

Icon

Explanation

✓

All features are supported.

⊛

The driver version will work with the MongoDB version, but not all new MongoDB features are supported.

✗

The driver version will not work with the MongoDB version. Attempting to connect to the MongoDB version will result in errors.

No mark

The driver version is not tested with the MongoDB version.

PyMongo Version

MongoDB 8.0

MongoDB 7.0

MongoDB 6.0

4.9 to 4.13

✓

✓

✓

4.4 to 4.8

⊛

✓

✓

4.2 to 4.3

⊛

⊛

✓

3.7 to 4.1

⊛

⊛

⊛

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:

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

[1]

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 [2]

✓

✓

✓

✓

✓

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 [2]

✓

✓

✓

✓

✓

4.0

✓

✓

✓

✓

✓

3.12

✓

✓

✓

✓

✓

✓

3.11

✓

✓

✓

✓

✓

3.10

✓

✓

✓

✓

3.7 to 3.9

✓

✓

✓

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 MongoClientclient = 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 MongoClientclient = 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 picklepickle.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 picklefrom bson.objectid import ObjectIdoid = ObjectId()oid_bytes = pickle.dumps(oid, protocol=2)print("ObjectId: {}".format(oid))print("ObjectId bytes: {}".format(oid_bytes))
ObjectId: 67af9b1fae9260c0e97eb9ebObjectId 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 picklefrom bson.objectid import ObjectIdoid_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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4