Skip to content

PHPLIB-795, PHPLIB-796: Remove references to pre-3.6 servers #893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 1, 2022
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
16 changes: 2 additions & 14 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -575,18 +575,6 @@ axes:
display_name: "3.6"
variables:
VERSION: "3.6"
- id: "3.4"
display_name: "3.4"
variables:
VERSION: "3.4"
- id: "3.2"
display_name: "3.2"
variables:
VERSION: "3.2"
- id: "3.0"
display_name: "3.0"
variables:
VERSION: "3.0"

- id: edge-versions
display_name: MongoDB Version
Expand All @@ -596,9 +584,9 @@ axes:
variables:
VERSION: "5.0"
- id: "oldest-supported"
display_name: "3.0"
display_name: "3.6"
variables:
VERSION: "3.0"
VERSION: "3.6"

- id: driver-versions
display_name: Driver Version
Expand Down
3 changes: 0 additions & 3 deletions docs/includes/apiargs-MongoDBClient-common-option.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ type: :php:`MongoDB\\Driver\\ReadConcern <class.mongodb-driver-readconcern>`
description: |
:manual:`Read concern </reference/read-concern>` to use for the operation.
Defaults to the client's read concern.

This is not supported for server versions prior to 3.2 and will result in an
exception at execution time if used.
interface: phpmethod
operation: ~
optional: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,4 @@ post: |
source:
file: apiargs-MongoDBClient-common-option.yaml
ref: writeConcern
post: |
This is not supported for server versions prior to 3.4 and will result in an
exception at execution time if used.
...
9 changes: 0 additions & 9 deletions docs/includes/apiargs-MongoDBCollection-common-option.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ type: array
description: |
An array of filter documents that determines which array elements to modify
for an update operation on an array field.

This is not supported for server versions prior to 3.6 and will result in an
exception at execution time if used.
interface: phpmethod
operation: ~
optional: true
Expand All @@ -17,9 +14,6 @@ type: boolean
description: |
If ``true``, allows the write operation to circumvent document level
validation. Defaults to ``false``.

This option is available in MongoDB 3.2+ and is ignored for older server
versions, which do not support document level validation.
interface: phpmethod
operation: ~
optional: true
Expand All @@ -40,9 +34,6 @@ description: |
:manual:`Read concern </reference/read-concern>` to use for the operation.
Defaults to the collection's read concern.

This is not supported for server versions prior to 3.2 and will result in an
exception at execution time if used.

It is not possible to specify a :manual:`read concern
</reference/read-concern>` for individual operations as part of a
transaction. Instead, set the ``readConcern`` option when starting the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,4 @@ source:
post: |
This only applies when a :ref:`$out <agg-out>` or :ref:`$merge <agg-merge>`
stage is specified.

This is not supported for server versions prior to 3.4 and will result in an
exception at execution time if used.
...
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,4 @@ post: |
source:
file: apiargs-MongoDBCollection-common-option.yaml
ref: writeConcern
post: |
This is not supported for server versions prior to 3.4 and will result in an
exception at execution time if used.
...
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,4 @@ post: |
source:
file: apiargs-MongoDBCollection-common-option.yaml
ref: writeConcern
post: |
This is not supported for server versions prior to 3.4 and will result in an
exception at execution time if used.
...
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,4 @@ post: |
source:
file: apiargs-MongoDBCollection-common-option.yaml
ref: writeConcern
post: |
This is not supported for server versions prior to 3.4 and will result in an
exception at execution time if used.
...
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,4 @@ post: |
source:
file: apiargs-MongoDBCollection-common-option.yaml
ref: writeConcern
post: |
This is not supported for server versions prior to 3.4 and will result in an
exception at execution time if used.
...
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,4 @@ post: |
source:
file: apiargs-MongoDBCollection-common-option.yaml
ref: writeConcern
post: |
This is not supported for server versions prior to 3.4 and will result in an
exception at execution time if used.
...
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,4 @@ post: |
source:
file: apiargs-MongoDBCollection-common-option.yaml
ref: writeConcern
post: |
This is not supported for server versions prior to 3.2 and will result in an
exception at execution time if used.
...
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,4 @@ source:
source:
file: apiargs-MongoDBCollection-common-option.yaml
ref: writeConcern
post: |
This is not supported for server versions prior to 3.2 and will result in an
exception at execution time if used.
...
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,4 @@ source:
source:
file: apiargs-MongoDBCollection-common-option.yaml
ref: writeConcern
post: |
This is not supported for server versions prior to 3.2 and will result in an
exception at execution time if used.
...
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ source:
source:
file: apiargs-MongoDBCollection-common-option.yaml
ref: writeConcern
post: |
This is not supported for server versions prior to 3.4 and will result in an
exception at execution time if used.
---
arg_name: option
name: dropTarget
Expand Down
3 changes: 0 additions & 3 deletions docs/includes/apiargs-MongoDBDatabase-common-option.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ type: :php:`MongoDB\\Driver\\ReadConcern <class.mongodb-driver-readconcern>`
description: |
:manual:`Read concern </reference/read-concern>` to use for the operation.
Defaults to the database's read concern.

This is not supported for server versions prior to 3.2 and will result in an
exception at execution time if used.
interface: phpmethod
operation: ~
optional: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,4 @@ source:
post: |
This only applies when a :ref:`$out <agg-out>` or :ref:`$merge <agg-merge>`
stage is specified.

This is not supported for server versions prior to 3.4 and will result in an
exception at execution time if used.
...
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,4 @@ optional: true
source:
file: apiargs-MongoDBDatabase-common-option.yaml
ref: writeConcern
post: |
This is not supported for server versions prior to 3.4 and will result in an
exception at execution time if used.
...
3 changes: 0 additions & 3 deletions docs/includes/apiargs-MongoDBDatabase-method-drop-option.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,4 @@ post: |
source:
file: apiargs-MongoDBDatabase-common-option.yaml
ref: writeConcern
post: |
This is not supported for server versions prior to 3.4 and will result in an
exception at execution time if used.
...
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,4 @@ post: |
source:
file: apiargs-MongoDBDatabase-common-option.yaml
ref: writeConcern
post: |
This is not supported for server versions prior to 3.4 and will result in an
exception at execution time if used.
...
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ post: |
source:
file: apiargs-MongoDBDatabase-common-option.yaml
ref: writeConcern
post: |
This is not supported for server versions prior to 3.4 and will result in an
exception at execution time if used.
---
arg_name: option
name: dropTarget
Expand Down
3 changes: 0 additions & 3 deletions docs/includes/apiargs-aggregate-option.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ source:
post: |
This only applies when using the :ref:`$out <agg-out>` and
:ref:`$out <agg-merge>` stages.

Document validation requires MongoDB 3.2 or later: if you are using an earlier
version of MongoDB, this option will be ignored.
---
arg_name: option
name: comment
Expand Down
5 changes: 0 additions & 5 deletions docs/includes/apiargs-common-option.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ description: |
mandatory; all other collation fields are optional. For descriptions of the
fields, see :manual:`Collation Document
</reference/collation/#collation-document>`.

This option is available in MongoDB 3.4+ and will result in an exception at
execution time if specified for an older server version.
interface: phpmethod
operation: ~
optional: true
Expand Down Expand Up @@ -68,8 +65,6 @@ name: session
type: :php:`MongoDB\\Driver\\Session <class.mongodb-driver-session>`
description: |
Client session to associate with the operation.

Sessions are not supported for server versions prior to 3.6.
interface: phpmethod
operation: ~
optional: true
Expand Down
6 changes: 0 additions & 6 deletions docs/reference/exception-classes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ MongoDB\\Exception\\UnsupportedException
selected server. It is used sparingly in cases where silently ignoring the
unsupported option might otherwise lead to unexpected behavior.

For example, the ``collation`` option for
:phpmethod:`MongoDB\\Collection::deleteOne()` is only supported by
MongoDB 3.4+. Since collation determines how a document is matched, silently
ignoring the option for an older server version could result in an
unintended document being deleted.

This class extends the library's :phpclass:`RuntimeException
<MongoDB\\Exception\\RuntimeException>` class.

Expand Down
3 changes: 1 addition & 2 deletions docs/reference/method/MongoDBCollection-count.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ metadata. Even when provided with a query filter the ``count`` command can
return inaccurate results with a sharded cluster if orphaned documents exist or
if a chunk migration is in progress. The
:phpmethod:`MongoDB\\Collection::countDocuments()` method avoids these sharded
cluster problems entirely when used with MongoDB 3.6+, and when a primary read
preference with older sharded clusters.
cluster problems entirely.

.. include:: /includes/extracts/note-bson-comparison.rst

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/method/MongoDBCollection-countDocuments.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Consider the following alternatives to these restricted operators:
- :query:`$geoWithin` with :query:`$centerSphere`

* - :query:`$where`
- :query:`$expr` (requires MongoDB 3.6+)
- :query:`$expr`

.. include:: /includes/extracts/note-bson-comparison.rst

Expand Down
8 changes: 3 additions & 5 deletions docs/reference/method/MongoDBDatabase-createCollection.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ Definition

.. include:: /includes/apiargs/MongoDBDatabase-method-createCollection-option.rst

Note that not all options are available on all versions of MongoDB. Document
validation, for example, was added in MongoDB 3.2; similarly, the WiredTiger
storage engine is available only for MongoDB 3.0 and later. Refer to the
:manual:`create </reference/command/create>` command reference in the MongoDB
manual for compatibility considerations.
Note that not all options are available on all versions of MongoDB. Refer to
the :manual:`create </reference/command/create>` command reference in the
MongoDB manual for compatibility considerations.

Return Values
-------------
Expand Down
10 changes: 2 additions & 8 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ class Client
'root' => BSONDocument::class,
];

/** @var integer */
private static $wireVersionForReadConcern = 4;

/** @var integer */
private static $wireVersionForWritableCommandWriteConcern = 5;

/** @var string */
private static $handshakeSeparator = ' / ';

Expand Down Expand Up @@ -215,7 +209,7 @@ public function dropDatabase($databaseName, array $options = [])

$server = select_server($this->manager, $options);

if (! isset($options['writeConcern']) && server_supports_feature($server, self::$wireVersionForWritableCommandWriteConcern) && ! is_in_transaction($options)) {
if (! isset($options['writeConcern']) && ! is_in_transaction($options)) {
$options['writeConcern'] = $this->writeConcern;
}

Expand Down Expand Up @@ -372,7 +366,7 @@ public function watch(array $pipeline = [], array $options = [])

$server = select_server($this->manager, $options);

if (! isset($options['readConcern']) && server_supports_feature($server, self::$wireVersionForReadConcern) && ! is_in_transaction($options)) {
if (! isset($options['readConcern']) && ! is_in_transaction($options)) {
$options['readConcern'] = $this->readConcern;
}

Expand Down
Loading