Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 11 additions & 41 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1014,33 +1014,6 @@ tasks:
TOPOLOGY: "server"
- func: "run doctests"

- name: "test-3.6-standalone"
tags: ["3.6", "standalone"]
commands:
- func: "bootstrap mongo-orchestration"
vars:
VERSION: "3.6"
TOPOLOGY: "server"
- func: "run tests"

- name: "test-3.6-replica_set"
tags: ["3.6", "replica_set"]
commands:
- func: "bootstrap mongo-orchestration"
vars:
VERSION: "3.6"
TOPOLOGY: "replica_set"
- func: "run tests"

- name: "test-3.6-sharded_cluster"
tags: ["3.6", "sharded_cluster"]
commands:
- func: "bootstrap mongo-orchestration"
vars:
VERSION: "3.6"
TOPOLOGY: "sharded_cluster"
- func: "run tests"

- name: "test-4.0-standalone"
tags: ["4.0", "standalone"]
commands:
Expand Down Expand Up @@ -2186,10 +2159,6 @@ axes:
- id: mongodb-version
display_name: "MongoDB"
values:
- id: "3.6"
display_name: "MongoDB 3.6"
variables:
VERSION: "3.6"
- id: "4.0"
display_name: "MongoDB 4.0"
variables:
Expand Down Expand Up @@ -2490,7 +2459,6 @@ buildvariants:
- ".4.4"
- ".4.2"
- ".4.0"
- ".3.6"

- matrix_name: "test-macos-arm64"
matrix_spec:
Expand Down Expand Up @@ -2562,7 +2530,6 @@ buildvariants:
- ".4.4"
- ".4.2"
- ".4.0"
- ".3.6"

- matrix_name: "tests-pyopenssl"
matrix_spec:
Expand Down Expand Up @@ -2657,19 +2624,22 @@ buildvariants:
display_name: "${compression} ${c-extensions} ${python-version} ${platform}"
tasks:
- "test-latest-standalone"
- "test-8.0-standalone"
- "test-7.0-standalone"
- "test-6.0-standalone"
- "test-5.0-standalone"
- "test-4.4-standalone"
- "test-4.2-standalone"
- "test-4.0-standalone"
rules:
# Server versions 3.6 and 4.0 support snappy and zlib.
# Server version 4.0 supports snappy and zlib but not zstd.
- if:
python-version: "*"
c-extensions: "*"
compression: ["snappy", "zlib"]
compression: ["zstd"]
then:
add_tasks:
remove_tasks:
- "test-4.0-standalone"
- "test-3.6-standalone"

- matrix_name: "tests-python-version-green-framework-rhel8"
matrix_spec:
Expand Down Expand Up @@ -2734,7 +2704,7 @@ buildvariants:
matrix_spec:
platform: rhel8
storage-engine: "*"
python-version: 3.9
python-version: "3.9"
display_name: "Storage ${storage-engine} ${python-version} ${platform}"
rules:
- if:
Expand All @@ -2751,7 +2721,6 @@ buildvariants:
- "test-4.4-standalone"
- "test-4.2-standalone"
- "test-4.0-standalone"
- "test-3.6-standalone"
- if:
# MongoDB 4.2 drops support for MMAPv1
platform: rhel8
Expand All @@ -2761,8 +2730,6 @@ buildvariants:
add_tasks:
- "test-4.0-standalone"
- "test-4.0-replica_set"
- "test-3.6-standalone"
- "test-3.6-replica_set"

# enableTestCommands=0 tests on RHEL 8.4 (x86_64) with Python 3.9.
- matrix_name: "test-disableTestCommands"
Expand Down Expand Up @@ -2881,6 +2848,9 @@ buildvariants:
tasks:
# Versioned API was introduced in MongoDB 4.7
- "test-latest-standalone"
- "test-8.0-standalone"
- "test-7.0-standalone"
- "test-6.0-standalone"
- "test-5.0-standalone"

- matrix_name: "ocsp-test"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ a native Python driver for MongoDB. The `gridfs` package is a
[gridfs](https://github.com/mongodb/specifications/blob/master/source/gridfs/gridfs-spec.rst/)
implementation on top of `pymongo`.

PyMongo supports MongoDB 3.6, 4.0, 4.2, 4.4, 5.0, 6.0, 7.0, and 8.0.
PyMongo supports MongoDB 4.0, 4.2, 4.4, 5.0, 6.0, 7.0, and 8.0.

## Support / Feedback

Expand Down
15 changes: 15 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ Changes in Version 4.11.0
-------------------------

.. warning:: PyMongo 4.11 drops support for Python 3.8: Python 3.9+ or PyPy 3.9+ is now required.
.. warning:: PyMongo 4.11 drops support for MongoDB 3.6. PyMongo now supports MongoDB 4.0+.
Driver support for MongoDB 3.6 reached end of life in April 2024.

PyMongo 4.11 brings a number of changes including:

- Dropped support for Python 3.8.
- Dropped support for MongoDB 3.6.

Issues Resolved
...............

See the `PyMongo 4.11 release notes in JIRA`_ for the list of resolved issues
in this release.

.. _PyMongo 4.11 release notes in JIRA: https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=10004&version=40784

Changes in Version 4.10.1
-------------------------
Expand Down
6 changes: 3 additions & 3 deletions doc/common-issues.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ Also see the :ref:`TLSErrors` section.
Server reports wire version X, PyMongo requires Y
-------------------------------------------------

When one attempts to connect to a <=3.4 version server, PyMongo will throw the following error::
When one attempts to connect to a <=3.6 version server, PyMongo will throw the following error::

>>> client.admin.command('ping')
...
pymongo.errors.ConfigurationError: Server at localhost:27017 reports wire version 5, but this version of PyMongo requires at least 6 (MongoDB 3.6).
pymongo.errors.ConfigurationError: Server at localhost:27017 reports wire version 6, but this version of PyMongo requires at least 7 (MongoDB 4.0).

This is caused by the driver being too new for the server it is being run against.
To resolve this issue either upgrade your database to version >= 3.6 or downgrade to PyMongo 3.x which supports MongoDB >= 2.6.
To resolve this issue either upgrade your database to version >= 4.0 or downgrade to an early version of PyMongo which supports MongoDB < 4.0.


'Cursor' object has no attribute '_Cursor__killed'
Expand Down
5 changes: 2 additions & 3 deletions doc/examples/authentication.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ the "MongoDB Challenge-Response" protocol::
Default Authentication Mechanism
--------------------------------

If no mechanism is specified, PyMongo automatically SCRAM-SHA-1 when connected
to MongoDB 3.6 and negotiates the mechanism to use (SCRAM-SHA-1
or SCRAM-SHA-256) when connected to MongoDB 4.0+.
If no mechanism is specified, PyMongo automatically negotiates the mechanism to use (SCRAM-SHA-1
or SCRAM-SHA-256) with the MongoDB server.

Default Database and "authSource"
---------------------------------
Expand Down
5 changes: 0 additions & 5 deletions pymongo/asynchronous/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1960,20 +1960,15 @@ async def _count_cmd(
collation: Optional[Collation],
) -> int:
"""Internal count command helper."""
# XXX: "ns missing" checks can be removed when we drop support for
# MongoDB 3.0, see SERVER-17051.
res = await self._command(
conn,
cmd,
read_preference=read_preference,
allowable_errors=["ns missing"],
codec_options=self._write_response_codec_options,
read_concern=self.read_concern,
collation=collation,
session=session,
)
if res.get("errmsg", "") == "ns missing":
return 0
return int(res["n"])

async def _aggregate_one_result(
Expand Down
5 changes: 2 additions & 3 deletions pymongo/asynchronous/mongo_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,8 @@ def __init__(
- `authSource`: The database to authenticate on. Defaults to the
database specified in the URI, if provided, or to "admin".
- `authMechanism`: See :data:`~pymongo.auth.MECHANISMS` for options.
If no mechanism is specified, PyMongo automatically SCRAM-SHA-1
when connected to MongoDB 3.6 and negotiates the mechanism to use
(SCRAM-SHA-1 or SCRAM-SHA-256) when connected to MongoDB 4.0+.
If no mechanism is specified, PyMongo automatically negotiates the
mechanism to use (SCRAM-SHA-1 or SCRAM-SHA-256) with the MongoDB server.
- `authMechanismProperties`: Used to specify authentication mechanism
specific options. To specify the service name for GSSAPI
authentication pass authMechanismProperties='SERVICE_NAME:<service
Expand Down
4 changes: 2 additions & 2 deletions pymongo/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
MAX_WRITE_BATCH_SIZE = 1000

# What this version of PyMongo supports.
MIN_SUPPORTED_SERVER_VERSION = "3.6"
MIN_SUPPORTED_WIRE_VERSION = 6
MIN_SUPPORTED_SERVER_VERSION = "4.0"
MIN_SUPPORTED_WIRE_VERSION = 7
# MongoDB 8.0
MAX_SUPPORTED_WIRE_VERSION = 25

Expand Down
5 changes: 0 additions & 5 deletions pymongo/synchronous/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1959,20 +1959,15 @@ def _count_cmd(
collation: Optional[Collation],
) -> int:
"""Internal count command helper."""
# XXX: "ns missing" checks can be removed when we drop support for
# MongoDB 3.0, see SERVER-17051.
res = self._command(
conn,
cmd,
read_preference=read_preference,
allowable_errors=["ns missing"],
codec_options=self._write_response_codec_options,
read_concern=self.read_concern,
collation=collation,
session=session,
)
if res.get("errmsg", "") == "ns missing":
return 0
return int(res["n"])

def _aggregate_one_result(
Expand Down
5 changes: 2 additions & 3 deletions pymongo/synchronous/mongo_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,8 @@ def __init__(
- `authSource`: The database to authenticate on. Defaults to the
database specified in the URI, if provided, or to "admin".
- `authMechanism`: See :data:`~pymongo.auth.MECHANISMS` for options.
If no mechanism is specified, PyMongo automatically SCRAM-SHA-1
when connected to MongoDB 3.6 and negotiates the mechanism to use
(SCRAM-SHA-1 or SCRAM-SHA-256) when connected to MongoDB 4.0+.
If no mechanism is specified, PyMongo automatically negotiates the
mechanism to use (SCRAM-SHA-1 or SCRAM-SHA-256) with the MongoDB server.
- `authMechanismProperties`: Used to specify authentication mechanism
specific options. To specify the service name for GSSAPI
authentication pass authMechanismProperties='SERVICE_NAME:<service
Expand Down
8 changes: 4 additions & 4 deletions test/asynchronous/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
from pymongo.asynchronous.settings import TOPOLOGY_TYPE
from pymongo.asynchronous.topology import _ErrorContext
from pymongo.client_options import ClientOptions
from pymongo.common import _UUID_REPRESENTATIONS, CONNECT_TIMEOUT, has_c
from pymongo.common import _UUID_REPRESENTATIONS, CONNECT_TIMEOUT, MIN_SUPPORTED_WIRE_VERSION, has_c
from pymongo.compression_support import _have_snappy, _have_zstd
from pymongo.driver_info import DriverInfo
from pymongo.errors import (
Expand Down Expand Up @@ -2455,8 +2455,8 @@ async def _test_network_error(self, operation_callback):
self.addAsyncCleanup(c.close)

# Set host-specific information so we can test whether it is reset.
c.set_wire_version_range("a:1", 2, 6)
c.set_wire_version_range("b:2", 2, 7)
c.set_wire_version_range("a:1", 2, MIN_SUPPORTED_WIRE_VERSION)
c.set_wire_version_range("b:2", 2, MIN_SUPPORTED_WIRE_VERSION + 1)
await (await c._get_topology()).select_servers(writable_server_selector, _Op.TEST)
wait_until(lambda: len(c.nodes) == 2, "connect")

Expand All @@ -2480,7 +2480,7 @@ async def _test_network_error(self, operation_callback):
sd_b = server_b.description
self.assertEqual(SERVER_TYPE.RSSecondary, sd_b.server_type)
self.assertEqual(2, sd_b.min_wire_version)
self.assertEqual(7, sd_b.max_wire_version)
self.assertEqual(MIN_SUPPORTED_WIRE_VERSION + 1, sd_b.max_wire_version)

async def test_network_error_on_query(self):
async def callback(client):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"$oid": "000000000000000000000002"
},
"minWireVersion": 0,
"maxWireVersion": 21
"maxWireVersion": 7
}
]
],
Expand Down
4 changes: 2 additions & 2 deletions test/mockupdb/test_auth_recovering_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
except ImportError:
_HAVE_MOCKUPDB = False

from pymongo import MongoClient
from pymongo import common
from pymongo.errors import ServerSelectionTimeoutError

pytestmark = pytest.mark.mockupdb
Expand All @@ -39,7 +39,7 @@ def test_auth_recovering_member(self):
"ismaster",
{
"minWireVersion": 2,
"maxWireVersion": 6,
"maxWireVersion": common.MIN_SUPPORTED_WIRE_VERSION,
"ismaster": False,
"secondary": False,
"setName": "rs",
Expand Down
7 changes: 5 additions & 2 deletions test/mockupdb/test_cluster_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@

from bson import Timestamp
from pymongo import DeleteMany, InsertOne, MongoClient, UpdateOne
from pymongo.common import MIN_SUPPORTED_WIRE_VERSION
from pymongo.errors import OperationFailure

pytestmark = pytest.mark.mockupdb


class TestClusterTime(PyMongoTestCase):
def cluster_time_conversation(self, callback, replies, max_wire_version=6):
def cluster_time_conversation(
self, callback, replies, max_wire_version=MIN_SUPPORTED_WIRE_VERSION
):
cluster_time = Timestamp(0, 0)
server = MockupDB()

Expand Down Expand Up @@ -110,7 +113,7 @@ def test_monitor(self):
cluster_time = Timestamp(0, 0)
reply = {
"minWireVersion": 0,
"maxWireVersion": 6,
"maxWireVersion": MIN_SUPPORTED_WIRE_VERSION,
"$clusterTime": {"clusterTime": cluster_time},
}

Expand Down
3 changes: 2 additions & 1 deletion test/mockupdb/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@


from bson.objectid import ObjectId
from pymongo.common import MIN_SUPPORTED_WIRE_VERSION
from pymongo.errors import OperationFailure

pytestmark = pytest.mark.mockupdb
Expand Down Expand Up @@ -74,7 +75,7 @@ def _test_fail_on_operation_failure_with_code(self, code):
server = MockupDB()
server.run()
self.addCleanup(server.stop)
server.autoresponds("ismaster", maxWireVersion=6)
server.autoresponds("ismaster", maxWireVersion=MIN_SUPPORTED_WIRE_VERSION)

client = self.simple_client(server.uri)

Expand Down
5 changes: 3 additions & 2 deletions test/mockupdb/test_cursor_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@


from pymongo import MongoClient
from pymongo.common import MIN_SUPPORTED_WIRE_VERSION

pytestmark = pytest.mark.mockupdb

Expand All @@ -39,7 +40,7 @@ class TestCursorNamespace(PyMongoTestCase):

@classmethod
def setUpClass(cls):
cls.server = MockupDB(auto_ismaster={"maxWireVersion": 6})
cls.server = MockupDB(auto_ismaster={"maxWireVersion": 7})
cls.server.run()
cls.client = cls.unmanaged_simple_client(cls.server.uri)

Expand Down Expand Up @@ -95,7 +96,7 @@ class TestKillCursorsNamespace(PyMongoTestCase):

@classmethod
def setUpClass(cls):
cls.server = MockupDB(auto_ismaster={"maxWireVersion": 6})
cls.server = MockupDB(auto_ismaster={"maxWireVersion": MIN_SUPPORTED_WIRE_VERSION})
cls.server.run()
cls.client = cls.unmanaged_simple_client(cls.server.uri)

Expand Down
Loading
Loading