Unverified Commit 4e345a10 authored by Andreas Braun's avatar Andreas Braun

Merge pull request #732

* phplib-539:
  PHPLIB-539: Rework client-side error logic for unacknowledged findAndModify
  Rework client-side error logic for hints in updates
  PHPLIB-539: support hint in findAndDelete operations
  PHPLIB-539: Sync CRUD spec tests
  PHPLIB-539: Allow hinting for delete
  Allow customizing the driver repository for travis-ci
parents 7b084d30 ee91ccf4
......@@ -16,14 +16,17 @@ tpecl () {
fi
}
if [ "x${DRIVER_BRANCH}" != "x" ]; then
echo "Compiling driver branch ${DRIVER_BRANCH}"
if [ "x${DRIVER_BRANCH}" != "x" ] || [ "x${DRIVER_REPO}" != "x" ]; then
CLONE_REPO=${DRIVER_REPO:-https://github.com/mongodb/mongo-php-driver}
CHECKOUT_BRANCH=${DRIVER_BRANCH:-master}
echo "Compiling driver branch ${CHECKOUT_BRANCH} from repository ${CLONE_REPO}"
mkdir -p /tmp/compile
git clone https://github.com/mongodb/mongo-php-driver /tmp/compile/mongo-php-driver
git clone ${CLONE_REPO} /tmp/compile/mongo-php-driver
cd /tmp/compile/mongo-php-driver
git checkout ${DRIVER_BRANCH}
git checkout ${CHECKOUT_BRANCH}
git submodule update --init
phpize
./configure --enable-mongodb-developer-flags
......
......@@ -2,6 +2,15 @@ source:
file: apiargs-MongoDBCollection-common-option.yaml
ref: collation
---
source:
file: apiargs-common-option.yaml
ref: hint
post: |
This option is available in MongoDB 4.4+ and will result in an exception at
execution time if specified for an older server version.
.. versionadded:: 1.7
---
source:
file: apiargs-common-option.yaml
ref: session
......
......@@ -2,6 +2,15 @@ source:
file: apiargs-MongoDBCollection-common-option.yaml
ref: collation
---
source:
file: apiargs-common-option.yaml
ref: hint
post: |
This option is available in MongoDB 4.4+ and will result in an exception at
execution time if specified for an older server version.
.. versionadded:: 1.7
---
source:
file: apiargs-common-option.yaml
ref: session
......
......@@ -27,6 +27,7 @@ use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
use function is_array;
use function is_object;
use function is_string;
use function MongoDB\server_supports_feature;
/**
......@@ -43,6 +44,9 @@ class Delete implements Executable, Explainable
/** @var integer */
private static $wireVersionForCollation = 5;
/** @var int */
private static $wireVersionForHintServerSideError = 5;
/** @var string */
private $databaseName;
......@@ -68,6 +72,13 @@ class Delete implements Executable, Explainable
* This is not supported for server versions < 3.4 and will result in an
* exception at execution time if used.
*
* * hint (string|document): The index to use. Specify either the index
* name as a string or the index key pattern as a document. If specified,
* then the query system will only consider plans using the hinted index.
*
* This is not supported for server versions < 4.4 and will result in an
* exception at execution time if used.
*
* * session (MongoDB\Driver\Session): Client session.
*
* Sessions are not supported for server versions < 3.6.
......@@ -97,6 +108,10 @@ class Delete implements Executable, Explainable
throw InvalidArgumentException::invalidType('"collation" option', $options['collation'], 'array or object');
}
if (isset($options['hint']) && ! is_string($options['hint']) && ! is_array($options['hint']) && ! is_object($options['hint'])) {
throw InvalidArgumentException::invalidType('"hint" option', $options['hint'], ['string', 'array', 'object']);
}
if (isset($options['session']) && ! $options['session'] instanceof Session) {
throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class);
}
......@@ -130,6 +145,13 @@ class Delete implements Executable, Explainable
throw UnsupportedException::collationNotSupported();
}
/* Server versions >= 3.4.0 raise errors for unknown update
* options. For previous versions, the CRUD spec requires a client-side
* error. */
if (isset($this->options['hint']) && ! server_supports_feature($server, self::$wireVersionForHintServerSideError)) {
throw UnsupportedException::hintNotSupported();
}
$inTransaction = isset($this->options['session']) && $this->options['session']->isInTransaction();
if ($inTransaction && isset($this->options['writeConcern'])) {
throw UnsupportedException::writeConcernNotSupportedInTransaction();
......@@ -170,6 +192,10 @@ class Delete implements Executable, Explainable
$deleteOptions['collation'] = (object) $this->options['collation'];
}
if (isset($this->options['hint'])) {
$deleteOptions['hint'] = $this->options['hint'];
}
return $deleteOptions;
}
......
......@@ -45,6 +45,13 @@ class DeleteMany implements Executable, Explainable
* This is not supported for server versions < 3.4 and will result in an
* exception at execution time if used.
*
* * hint (string|document): The index to use. Specify either the index
* name as a string or the index key pattern as a document. If specified,
* then the query system will only consider plans using the hinted index.
*
* This is not supported for server versions < 4.4 and will result in an
* exception at execution time if used.
*
* * session (MongoDB\Driver\Session): Client session.
*
* Sessions are not supported for server versions < 3.6.
......
......@@ -45,6 +45,13 @@ class DeleteOne implements Executable, Explainable
* This is not supported for server versions < 3.4 and will result in an
* exception at execution time if used.
*
* * hint (string|document): The index to use. Specify either the index
* name as a string or the index key pattern as a document. If specified,
* then the query system will only consider plans using the hinted index.
*
* This is not supported for server versions < 4.4 and will result in an
* exception at execution time if used.
*
* * session (MongoDB\Driver\Session): Client session.
*
* Sessions are not supported for server versions < 3.6.
......
......@@ -55,6 +55,9 @@ class FindAndModify implements Executable, Explainable
/** @var integer */
private static $wireVersionForDocumentLevelValidation = 4;
/** @var integer */
private static $wireVersionForHint = 9;
/** @var integer */
private static $wireVersionForHintServerSideError = 8;
......@@ -99,8 +102,7 @@ class FindAndModify implements Executable, Explainable
* name as a string or the index key pattern as a document. If specified,
* then the query system will only consider plans using the hinted index.
*
* This is only supported for update and replace operations (i.e. remove
* option is false) on server versions >= 4.4. Using this option in
* This is only supported on server versions >= 4.4. Using this option in
* other contexts will result in an exception at execution time.
*
* * maxTimeMS (integer): The maximum amount of time to allow the query to
......@@ -246,7 +248,7 @@ class FindAndModify implements Executable, Explainable
* options (SERVER-40005), but the CRUD spec requires client-side errors
* for server versions < 4.2. For later versions, we'll rely on the
* server to either utilize the option or report its own error. */
if (isset($this->options['hint']) && ! server_supports_feature($server, self::$wireVersionForHintServerSideError)) {
if (isset($this->options['hint']) && ! $this->isHintSupported($server)) {
throw UnsupportedException::hintNotSupported();
}
......@@ -339,4 +341,20 @@ class FindAndModify implements Executable, Explainable
return $options;
}
private function isAcknowledgedWriteConcern() : bool
{
if (! isset($this->options['writeConcern'])) {
return true;
}
return $this->options['writeConcern']->getW() > 1 || $this->options['writeConcern']->getJournal();
}
private function isHintSupported(Server $server) : bool
{
$requiredWireVersion = $this->isAcknowledgedWriteConcern() ? self::$wireVersionForHintServerSideError : self::$wireVersionForHint;
return server_supports_feature($server, $requiredWireVersion);
}
}
......@@ -46,6 +46,13 @@ class FindOneAndDelete implements Executable, Explainable
* This is not supported for server versions < 3.4 and will result in an
* exception at execution time if used.
*
* * hint (string|document): The index to use. Specify either the index
* name as a string or the index key pattern as a document. If specified,
* then the query system will only consider plans using the hinted index.
*
* This is not supported for server versions < 4.4 and will result in an
* exception at execution time if used.
*
* * maxTimeMS (integer): The maximum amount of time to allow the query to
* run.
*
......
......@@ -54,7 +54,7 @@ class Update implements Executable, Explainable
private static $wireVersionForDocumentLevelValidation = 4;
/** @var integer */
private static $wireVersionForHint = 8;
private static $wireVersionForHintServerSideError = 5;
/** @var string */
private $databaseName;
......@@ -202,7 +202,10 @@ class Update implements Executable, Explainable
throw UnsupportedException::collationNotSupported();
}
if (isset($this->options['hint']) && ! server_supports_feature($server, self::$wireVersionForHint)) {
/* Server versions >= 3.4.0 raise errors for unknown update
* options. For previous versions, the CRUD spec requires a client-side
* error. */
if (isset($this->options['hint']) && ! server_supports_feature($server, self::$wireVersionForHintServerSideError)) {
throw UnsupportedException::hintNotSupported();
}
......
......@@ -73,7 +73,7 @@ class CrudSpecTest extends FunctionalTestCase
}
if (isset($test->expectations)) {
$commandExpectations = CommandExpectations::fromCrud($test->expectations);
$commandExpectations = CommandExpectations::fromCrud((array) $test->expectations);
$commandExpectations->startMonitoring();
}
......
{
"runOn": [
{
"maxServerVersion": "3.3.99"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
],
"collection_name": "BulkWrite_delete_hint",
"tests": [
{
"description": "BulkWrite deleteOne with hints unsupported (client-side error)",
"operations": [
{
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
},
"hint": "_id_"
}
},
{
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 2
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
},
"error": true
}
],
"expectations": [],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
},
{
"description": "BulkWrite deleteMany with hints unsupported (client-side error)",
"operations": [
{
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$lt": 3
}
},
"hint": "_id_"
}
},
{
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$gte": 4
}
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
},
"error": true
}
],
"expectations": [],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "3.4.0",
"maxServerVersion": "4.3.3"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
],
"collection_name": "BulkWrite_delete_hint",
"tests": [
{
"description": "BulkWrite deleteOne with hints unsupported (server-side error)",
"operations": [
{
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
},
"hint": "_id_"
}
},
{
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 2
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
},
"error": true
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "BulkWrite_delete_hint",
"deletes": [
{
"q": {
"_id": 1
},
"hint": "_id_",
"limit": 1
},
{
"q": {
"_id": 2
},
"hint": {
"_id": 1
},
"limit": 1
}
],
"ordered": true
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
},
{
"description": "BulkWrite deleteMany with hints unsupported (server-side error)",
"operations": [
{
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$lt": 3
}
},
"hint": "_id_"
}
},
{
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$gte": 4
}
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
},
"error": true
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "BulkWrite_delete_hint",
"deletes": [
{
"q": {
"_id": {
"$lt": 3
}
},
"hint": "_id_",
"limit": 0
},
{
"q": {
"_id": {
"$gte": 4
}
},
"hint": {
"_id": 1
},
"limit": 0
}
],
"ordered": true
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "4.3.4"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
],
"collection_name": "BulkWrite_delete_hint",
"tests": [
{
"description": "BulkWrite deleteOne with hints",
"operations": [
{
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
},
"hint": "_id_"
}
},
{
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 2
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
},
"result": {
"deletedCount": 2,
"insertedCount": 0,
"insertedIds": {},
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "BulkWrite_delete_hint",
"deletes": [
{
"q": {
"_id": 1
},
"hint": "_id_",
"limit": 1
},
{
"q": {
"_id": 2
},
"hint": {
"_id": 1
},
"limit": 1
}
],
"ordered": true
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
},
{
"description": "BulkWrite deleteMany with hints",
"operations": [
{
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$lt": 3
}
},
"hint": "_id_"
}
},
{
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$gte": 4
}
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
},
"result": {
"deletedCount": 3,
"insertedCount": 0,
"insertedIds": {},
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "BulkWrite_delete_hint",
"deletes": [
{
"q": {
"_id": {
"$lt": 3
}
},
"hint": "_id_",
"limit": 0
},
{
"q": {
"_id": {
"$gte": 4
}
},
"hint": {
"_id": 1
},
"limit": 0
}
],
"ordered": true
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 3,
"x": 33
}
]
}
}
}
]
}
{
"runOn": [
{
"maxServerVersion": "3.3.99"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
],
"collection_name": "test_bulkwrite_update_hint",
"tests": [
{
"description": "BulkWrite updateOne with update hints unsupported (client-side error)",
"operations": [
{
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "updateOne",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
}
},
{
"name": "updateOne",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
},
"error": true
}
],
"expectations": [],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
},
{
"description": "BulkWrite updateMany with update hints unsupported (client-side error)",
"operations": [
{
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "updateMany",
"arguments": {
"filter": {
"_id": {
"$lt": 3
}
},
"update": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
}
},
{
"name": "updateMany",
"arguments": {
"filter": {
"_id": {
"$lt": 3
}
},
"update": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
},
"error": true
}
],
"expectations": [],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
},
{
"description": "BulkWrite replaceOne with update hints unsupported (client-side error)",
"operations": [
{
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 3
},
"replacement": {
"x": 333
},
"hint": "_id_"
}
},
{
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"x": 444
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
},
"error": true
}
],
"expectations": [],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "3.4.0",
"maxServerVersion": "4.1.9"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
],
"collection_name": "test_bulkwrite_update_hint",
"tests": [
{
"description": "BulkWrite updateOne with update hints unsupported (server-side error)",
"operations": [
{
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "updateOne",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
}
},
{
"name": "updateOne",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
},
"error": true
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "test_bulkwrite_update_hint",
"updates": [
{
"q": {
"_id": 1
},
"u": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
},
{
"q": {
"_id": 1
},
"u": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
}
],
"ordered": true
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
},
{
"description": "BulkWrite updateMany with update hints unsupported (server-side error)",
"operations": [
{
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "updateMany",
"arguments": {
"filter": {
"_id": {
"$lt": 3
}
},
"update": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
}
},
{
"name": "updateMany",
"arguments": {
"filter": {
"_id": {
"$lt": 3
}
},
"update": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
},
"error": true
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "test_bulkwrite_update_hint",
"updates": [
{
"q": {
"_id": {
"$lt": 3
}
},
"u": {
"$inc": {
"x": 1
}
},
"multi": true,
"hint": "_id_"
},
{
"q": {
"_id": {
"$lt": 3
}
},
"u": {
"$inc": {
"x": 1
}
},
"multi": true,
"hint": {
"_id": 1
}
}
],
"ordered": true
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
},
{
"description": "BulkWrite replaceOne with update hints unsupported (server-side error)",
"operations": [
{
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 3
},
"replacement": {
"x": 333
},
"hint": "_id_"
}
},
{
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"x": 444
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
},
"error": true
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "test_bulkwrite_update_hint",
"updates": [
{
"q": {
"_id": 3
},
"u": {
"x": 333
},
"hint": "_id_"
},
{
"q": {
"_id": 4
},
"u": {
"x": 444
},
"hint": {
"_id": 1
}
}
],
"ordered": true
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
}
]
}
{
"runOn": [
{
"maxServerVersion": "3.3.99"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"collection_name": "DeleteMany_hint",
"tests": [
{
"description": "DeleteMany with hint string unsupported (client-side error)",
"operations": [
{
"object": "collection",
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"hint": "_id_"
},
"error": true
}
],
"expectations": [],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "DeleteMany with hint document unsupported (client-side error)",
"operations": [
{
"object": "collection",
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"hint": {
"_id": 1
}
},
"error": true
}
],
"expectations": [],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "3.4.0",
"maxServerVersion": "4.3.3"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"collection_name": "DeleteMany_hint",
"tests": [
{
"description": "DeleteMany with hint string unsupported (server-side error)",
"operations": [
{
"object": "collection",
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"hint": "_id_"
},
"error": true
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "DeleteMany_hint",
"deletes": [
{
"q": {
"_id": {
"$gt": 1
}
},
"hint": "_id_",
"limit": 0
}
]
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "DeleteMany with hint document unsupported (server-side error)",
"operations": [
{
"object": "collection",
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"hint": {
"_id": 1
}
},
"error": true
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "DeleteMany_hint",
"deletes": [
{
"q": {
"_id": {
"$gt": 1
}
},
"hint": {
"_id": 1
},
"limit": 0
}
]
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "4.3.4"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"collection_name": "DeleteMany_hint",
"tests": [
{
"description": "DeleteMany with hint string",
"operations": [
{
"object": "collection",
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"hint": "_id_"
},
"result": {
"deletedCount": 2
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "DeleteMany_hint",
"deletes": [
{
"q": {
"_id": {
"$gt": 1
}
},
"hint": "_id_",
"limit": 0
}
]
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
}
]
}
}
},
{
"description": "DeleteMany with hint document",
"operations": [
{
"object": "collection",
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"hint": {
"_id": 1
}
},
"result": {
"deletedCount": 2
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "DeleteMany_hint",
"deletes": [
{
"q": {
"_id": {
"$gt": 1
}
},
"hint": {
"_id": 1
},
"limit": 0
}
]
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
}
]
}
}
}
]
}
{
"runOn": [
{
"maxServerVersion": "3.3.99"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"collection_name": "DeleteOne_hint",
"tests": [
{
"description": "DeleteOne with hint string unsupported (client-side error)",
"operations": [
{
"object": "collection",
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
},
"hint": "_id_"
},
"error": true
}
],
"expectations": [],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
},
{
"description": "DeleteOne with hint document unsupported (client-side error)",
"operations": [
{
"object": "collection",
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
},
"hint": {
"_id": 1
}
},
"error": true
}
],
"expectations": [],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "3.4.0",
"maxServerVersion": "4.3.3"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"collection_name": "DeleteOne_hint",
"tests": [
{
"description": "DeleteOne with hint string unsupported (server-side error)",
"operations": [
{
"object": "collection",
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
},
"hint": "_id_"
},
"error": true
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "DeleteOne_hint",
"deletes": [
{
"q": {
"_id": 1
},
"hint": "_id_",
"limit": 1
}
]
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
},
{
"description": "DeleteOne with hint document unsupported (server-side error)",
"operations": [
{
"object": "collection",
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
},
"hint": {
"_id": 1
}
},
"error": true
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "DeleteOne_hint",
"deletes": [
{
"q": {
"_id": 1
},
"hint": {
"_id": 1
},
"limit": 1
}
]
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "4.3.4"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"collection_name": "DeleteOne_hint",
"tests": [
{
"description": "DeleteOne with hint string",
"operations": [
{
"object": "collection",
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
},
"hint": "_id_"
},
"result": {
"deletedCount": 1
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "DeleteOne_hint",
"deletes": [
{
"q": {
"_id": 1
},
"hint": "_id_",
"limit": 1
}
]
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 2,
"x": 22
}
]
}
}
},
{
"description": "deleteOne with hint document",
"operations": [
{
"object": "collection",
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
},
"hint": {
"_id": 1
}
},
"result": {
"deletedCount": 1
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "DeleteOne_hint",
"deletes": [
{
"q": {
"_id": 1
},
"hint": {
"_id": 1
},
"limit": 1
}
]
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}
{
"runOn": [
{
"maxServerVersion": "4.0.99"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"collection_name": "findOneAndDelete_hint",
"tests": [
{
"description": "FindOneAndDelete with hint string unsupported (client-side error)",
"operations": [
{
"object": "collection",
"name": "findOneAndDelete",
"arguments": {
"filter": {
"_id": 1
},
"hint": "_id_"
},
"error": true
}
],
"expectations": [],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
},
{
"description": "FindOneAndDelete with hint document",
"operations": [
{
"object": "collection",
"name": "findOneAndDelete",
"arguments": {
"filter": {
"_id": 1
},
"hint": {
"_id": 1
}
},
"error": true
}
],
"expectations": [],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "4.2.0",
"maxServerVersion": "4.3.3"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"collection_name": "findOneAndDelete_hint",
"tests": [
{
"description": "FindOneAndDelete with hint string unsupported (server-side error)",
"operations": [
{
"object": "collection",
"name": "findOneAndDelete",
"arguments": {
"filter": {
"_id": 1
},
"hint": "_id_"
},
"error": true
}
],
"expectations": [
{
"command_started_event": {
"command": {
"findAndModify": "findOneAndDelete_hint",
"query": {
"_id": 1
},
"hint": "_id_",
"remove": true
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
},
{
"description": "FindOneAndDelete with hint document unsupported (server-side error)",
"operations": [
{
"object": "collection",
"name": "findOneAndDelete",
"arguments": {
"filter": {
"_id": 1
},
"hint": {
"_id": 1
}
},
"error": true
}
],
"expectations": [
{
"command_started_event": {
"command": {
"findAndModify": "findOneAndDelete_hint",
"query": {
"_id": 1
},
"hint": {
"_id": 1
},
"remove": true
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "4.3.4"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"collection_name": "findOneAndDelete_hint",
"tests": [
{
"description": "FindOneAndDelete with hint string",
"operations": [
{
"object": "collection",
"name": "findOneAndDelete",
"arguments": {
"filter": {
"_id": 1
},
"hint": "_id_"
},
"result": {
"_id": 1,
"x": 11
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"findAndModify": "findOneAndDelete_hint",
"query": {
"_id": 1
},
"hint": "_id_",
"remove": true
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 2,
"x": 22
}
]
}
}
},
{
"description": "FindOneAndDelete with hint document",
"operations": [
{
"object": "collection",
"name": "findOneAndDelete",
"arguments": {
"filter": {
"_id": 1
},
"hint": {
"_id": 1
}
},
"result": {
"_id": 1,
"x": 11
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"findAndModify": "findOneAndDelete_hint",
"query": {
"_id": 1
},
"hint": {
"_id": 1
},
"remove": true
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}
{
"runOn": [
{
"maxServerVersion": "4.3.3"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
],
"collection_name": "BulkWrite_delete_hint",
"tests": [
{
"description": "Unacknowledged bulkWrite deleteOne with hints fails with client-side error on server < 4.4",
"operations": [
{
"name": "bulkWrite",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"requests": [
{
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
},
"hint": "_id_"
}
},
{
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 2
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
},
{
"description": "Unacknowledged bulkWrite deleteMany with hints fails with client-side error on server < 4.4",
"operations": [
{
"name": "bulkWrite",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"requests": [
{
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$lt": 3
}
},
"hint": "_id_"
}
},
{
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$gte": 4
}
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "4.3.4"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
],
"collection_name": "BulkWrite_delete_hint",
"tests": [
{
"description": "Unacknowledged bulkWrite deleteOne with hints succeeds on server >= 4.4",
"operations": [
{
"name": "bulkWrite",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"requests": [
{
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
},
"hint": "_id_"
}
},
{
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 2
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "BulkWrite_delete_hint",
"deletes": [
{
"q": {
"_id": 1
},
"hint": "_id_",
"limit": 1
},
{
"q": {
"_id": 2
},
"hint": {
"_id": 1
},
"limit": 1
}
],
"ordered": true
}
}
}
],
"outcome": {}
},
{
"description": "Unacknowledged bulkWrite deleteMany with hints succeeds on server >= 4.4",
"operations": [
{
"name": "bulkWrite",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"requests": [
{
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$lt": 3
}
},
"hint": "_id_"
}
},
{
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$gte": 4
}
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "BulkWrite_delete_hint",
"deletes": [
{
"q": {
"_id": {
"$lt": 3
}
},
"hint": "_id_",
"limit": 0
},
{
"q": {
"_id": {
"$gte": 4
}
},
"hint": {
"_id": 1
},
"limit": 0
}
],
"ordered": true
}
}
}
],
"outcome": {}
}
]
}
{
"runOn": [
{
"maxServerVersion": "4.1.9"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
],
"collection_name": "Bulkwrite_update_hint",
"tests": [
{
"description": "Unacknowledged bulkWrite updateOne with hints fails with client-side error on server < 4.2",
"operations": [
{
"name": "bulkWrite",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"requests": [
{
"name": "updateOne",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
}
},
{
"name": "updateOne",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
},
{
"description": "Unacknowledged bulkWrite updateMany with hints fails with client-side error on server < 4.2",
"operations": [
{
"name": "bulkWrite",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"requests": [
{
"name": "updateMany",
"arguments": {
"filter": {
"_id": {
"$lt": 3
}
},
"update": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
}
},
{
"name": "updateMany",
"arguments": {
"filter": {
"_id": {
"$lt": 3
}
},
"update": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
},
{
"description": "Unacknowledged bulkWrite replaceOne with hints unsupported (client-side error)",
"operations": [
{
"name": "bulkWrite",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"requests": [
{
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 3
},
"replacement": {
"x": 333
},
"hint": "_id_"
}
},
{
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"x": 444
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "4.2.0"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
],
"collection_name": "BulkWrite_update_hint",
"tests": [
{
"description": "Unacknowledged bulkWrite updateOne with update hint succeeds on server >= 4.2",
"operations": [
{
"name": "bulkWrite",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"requests": [
{
"name": "updateOne",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
}
},
{
"name": "updateOne",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "BulkWrite_update_hint",
"updates": [
{
"q": {
"_id": 1
},
"u": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
},
{
"q": {
"_id": 1
},
"u": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
}
],
"ordered": true
}
}
}
],
"outcome": {}
},
{
"description": "Unacknowledged bulkWrite updateMany with update hint succeeds on server >= 4.2",
"operations": [
{
"name": "bulkWrite",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"requests": [
{
"name": "updateMany",
"arguments": {
"filter": {
"_id": {
"$lt": 3
}
},
"update": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
}
},
{
"name": "updateMany",
"arguments": {
"filter": {
"_id": {
"$lt": 3
}
},
"update": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "BulkWrite_update_hint",
"updates": [
{
"q": {
"_id": {
"$lt": 3
}
},
"u": {
"$inc": {
"x": 1
}
},
"multi": true,
"hint": "_id_"
},
{
"q": {
"_id": {
"$lt": 3
}
},
"u": {
"$inc": {
"x": 1
}
},
"multi": true,
"hint": {
"_id": 1
}
}
],
"ordered": true
}
}
}
],
"outcome": {}
},
{
"description": "Unacknowledged bulkWrite replaceOne with update hints",
"operations": [
{
"name": "bulkWrite",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"requests": [
{
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 3
},
"replacement": {
"x": 333
},
"hint": "_id_"
}
},
{
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"x": 444
},
"hint": {
"_id": 1
}
}
}
],
"options": {
"ordered": true
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "BulkWrite_update_hint",
"updates": [
{
"q": {
"_id": 3
},
"u": {
"x": 333
},
"hint": "_id_"
},
{
"q": {
"_id": 4
},
"u": {
"x": 444
},
"hint": {
"_id": 1
}
}
],
"ordered": true
}
}
}
],
"outcome": {}
}
]
}
{
"runOn": [
{
"maxServerVersion": "4.3.3"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"collection_name": "DeleteMany_hint",
"tests": [
{
"description": "Unacknowledged deleteMany with hint string fails with client-side error on server < 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"hint": "_id_"
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "Unacknowledged deleteMany with hint document fails with client-side error on server < 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"hint": {
"_id": 1
}
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "4.3.4"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"collection_name": "DeleteMany_hint",
"tests": [
{
"description": "Unacknowledged deleteMany with hint string succeeds on server >= 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"hint": "_id_"
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "DeleteMany_hint",
"deletes": [
{
"q": {
"_id": {
"$gt": 1
}
},
"hint": "_id_",
"limit": 0
}
]
}
}
}
],
"outcome": {}
},
{
"description": "Unacknowledged deleteMany with hint document succeeds on server >= 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"hint": {
"_id": 1
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "DeleteMany_hint",
"deletes": [
{
"q": {
"_id": {
"$gt": 1
}
},
"hint": {
"_id": 1
},
"limit": 0
}
]
}
}
}
],
"outcome": {}
}
]
}
{
"runOn": [
{
"maxServerVersion": "4.3.3"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"collection_name": "DeleteOne_hint",
"tests": [
{
"description": "Unacknowledged deleteOne with hint string fails with client-side error on server < 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
},
"hint": "_id_"
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
},
{
"description": "Unacknowledged deleteOne with hint document fails with client-side error on server < 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
},
"hint": {
"_id": 1
}
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "4.3.4"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"collection_name": "DeleteOne_hint",
"tests": [
{
"description": "Unacknowledged deleteOne with hint string succeeds on server >= 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
},
"hint": "_id_"
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "DeleteOne_hint",
"deletes": [
{
"q": {
"_id": 1
},
"hint": "_id_",
"limit": 1
}
]
}
}
}
],
"outcome": {}
},
{
"description": "Unacknowledged deleteOne with hint document succeeds on server >= 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
},
"hint": {
"_id": 1
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "DeleteOne_hint",
"deletes": [
{
"q": {
"_id": 1
},
"hint": {
"_id": 1
},
"limit": 1
}
]
}
}
}
],
"outcome": {}
}
]
}
{
"runOn": [
{
"maxServerVersion": "4.3.3"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"collection_name": "findOneAndDelete_hint",
"tests": [
{
"description": "Unacknowledged findOneAndDelete with hint string fails with client-side error on server < 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "findOneAndDelete",
"arguments": {
"filter": {
"_id": 1
},
"hint": "_id_"
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
},
{
"description": "Unacknowledged findOneAndDelete with hint document fails with client-side error on server < 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "findOneAndDelete",
"arguments": {
"filter": {
"_id": 1
},
"hint": {
"_id": 1
}
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "4.3.4"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"collection_name": "findOneAndDelete_hint",
"tests": [
{
"description": "Unacknowledged findOneAndDelete with hint string succeeds on server >= 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "findOneAndDelete",
"arguments": {
"filter": {
"_id": 1
},
"hint": "_id_"
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"findAndModify": "findOneAndDelete_hint",
"query": {
"_id": 1
},
"hint": "_id_",
"remove": true
}
}
}
],
"outcome": {}
},
{
"description": "Unacknowledged findOneAndDelete with hint document succeeds on server >= 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "findOneAndDelete",
"arguments": {
"filter": {
"_id": 1
},
"hint": {
"_id": 1
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"findAndModify": "findOneAndDelete_hint",
"query": {
"_id": 1
},
"hint": {
"_id": 1
},
"remove": true
}
}
}
],
"outcome": {}
}
]
}
{
"runOn": [
{
"maxServerVersion": "4.3.3"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"collection_name": "FindOneAndReplace_hint",
"tests": [
{
"description": "Unacknowledged findOneAndReplace with hint string fails with client-side error on server < 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 1
},
"replacement": {
"x": 33
},
"hint": "_id_"
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
},
{
"description": "Unacknowledged findOneAndReplace with hint document fails with client-side error on server < 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 1
},
"replacement": {
"x": 33
},
"hint": {
"_id": 1
}
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "4.3.4"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"collection_name": "FindOneAndReplace_hint",
"tests": [
{
"description": "Unacknowledged findOneAndReplace with hint string succeeds on server >= 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 1
},
"replacement": {
"x": 33
},
"hint": "_id_"
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"findAndModify": "FindOneAndReplace_hint",
"query": {
"_id": 1
},
"update": {
"x": 33
},
"hint": "_id_"
}
}
}
],
"outcome": {}
},
{
"description": "Unacknowledged findOneAndReplace with hint document succeeds on server >= 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 1
},
"replacement": {
"x": 33
},
"hint": {
"_id": 1
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"findAndModify": "FindOneAndReplace_hint",
"query": {
"_id": 1
},
"update": {
"x": 33
}
}
}
}
],
"outcome": {}
}
]
}
{
"runOn": [
{
"maxServerVersion": "4.3.3"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"collection_name": "FindOneAndUpdate_hint",
"tests": [
{
"description": "Unacknowledged findOneAndUpdate with hint string fails with client-side error on server < 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
},
{
"description": "Unacknowledged findOneAndUpdate with hint document fails with client-side error on server < 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "4.3.4"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"collection_name": "FindOneAndUpdate_hint",
"tests": [
{
"description": "Unacknowledged findOneAndUpdate with hint string succeeds on server >= 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"findAndModify": "FindOneAndUpdate_hint",
"query": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
}
}
}
],
"outcome": {}
},
{
"description": "Unacknowledged findOneAndUpdate with hint document succeeds on server >= 4.4",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"findAndModify": "FindOneAndUpdate_hint",
"query": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
}
}
}
],
"outcome": {}
}
]
}
{
"runOn": [
{
"maxServerVersion": "4.1.9"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"collection_name": "ReplaceOne_hint",
"tests": [
{
"description": "Unacknowledged ReplaceOne with hint string fails with client-side error on server < 4.2",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "replaceOne",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"replacement": {
"x": 111
},
"hint": "_id_"
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
},
{
"description": "Unacknowledged ReplaceOne with hint document fails with client-side error on server < 4.2",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "replaceOne",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"replacement": {
"x": 111
},
"hint": {
"_id": 1
}
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "4.2.0"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"collection_name": "Replaceone_hint",
"tests": [
{
"description": "Unacknowledged replaceOne with hint string succeeds on server >= 4.2",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "replaceOne",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"replacement": {
"x": 111
},
"hint": "_id_"
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "Replaceone_hint",
"updates": [
{
"q": {
"_id": {
"$gt": 1
}
},
"u": {
"x": 111
},
"hint": "_id_"
}
]
}
}
}
],
"outcome": {}
},
{
"description": "Unacknowledged replaceOne with hint document succeeds on server >= 4.2",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "replaceOne",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"replacement": {
"x": 111
},
"hint": {
"_id": 1
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "Replaceone_hint",
"updates": [
{
"q": {
"_id": {
"$gt": 1
}
},
"u": {
"x": 111
},
"hint": {
"_id": 1
}
}
]
}
}
}
],
"outcome": {}
}
]
}
{
"runOn": [
{
"maxServerVersion": "4.1.9"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"collection_name": "Updatemany_hint",
"tests": [
{
"description": "Unacknowledged updateMany with hint string fails with client-side error on server < 4.2",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "updateMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"update": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "Unacknowledged updateMany with hint document fails with client-side error on server < 4.2",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "updateMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"update": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "4.2.0"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"collection_name": "UpdateMany_hint",
"tests": [
{
"description": "Unacknowledged updateMany with hint string succeeds on server >= 4.2",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "updateMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"update": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "UpdateMany_hint",
"updates": [
{
"q": {
"_id": {
"$gt": 1
}
},
"u": {
"$inc": {
"x": 1
}
},
"multi": true,
"hint": "_id_"
}
]
}
}
}
],
"outcome": {}
},
{
"description": "Unacknowledged updateMany with hint document succeeds on server >= 4.2",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "updateMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"update": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "UpdateMany_hint",
"updates": [
{
"q": {
"_id": {
"$gt": 1
}
},
"u": {
"$inc": {
"x": 1
}
},
"multi": true,
"hint": {
"_id": 1
}
}
]
}
}
}
],
"outcome": {}
}
]
}
{
"runOn": [
{
"maxServerVersion": "4.1.9"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"collection_name": "Updateone_hint",
"tests": [
{
"description": "Unacknowledged updateOne with hint string fails with client-side error on server < 4.2",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "updateOne",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"update": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
},
{
"description": "Unacknowledged updateOne with hint document fails with client-side error on server < 4.2",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "updateOne",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"update": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
},
"error": true
}
],
"expectations": {},
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}
{
"runOn": [
{
"minServerVersion": "4.2.0"
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"collection_name": "updateone_hint",
"tests": [
{
"description": "Unacknowledged updateOne with hint string succeeds on server >= 4.2",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "updateOne",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"update": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "updateone_hint",
"updates": [
{
"q": {
"_id": {
"$gt": 1
}
},
"u": {
"$inc": {
"x": 1
}
},
"hint": "_id_"
}
]
}
}
}
],
"outcome": {}
},
{
"description": "Unacknowledged updateOne with hint document succeeds on server >= 4.2",
"operations": [
{
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"name": "updateOne",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"update": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "updateone_hint",
"updates": [
{
"q": {
"_id": {
"$gt": 1
}
},
"u": {
"$inc": {
"x": 1
}
},
"hint": {
"_id": 1
}
}
]
}
}
}
],
"outcome": {}
}
]
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment