From 58b42d213a0c4babc39610d70d913e3b1ec90391 Mon Sep 17 00:00:00 2001 From: Isabel Atkinson Date: Fri, 30 Jul 2021 12:22:17 -0400 Subject: [PATCH 1/2] RUST-749 Convert CRUD tests to unified format --- src/selection_criteria.rs | 3 +- src/test/spec/crud_unified.rs | 15 - src/test/spec/crud_v2.rs | 12 - src/test/spec/json/crud/README.rst | 171 +++----- .../spec/json/crud/unified/aggregate-let.json | 5 +- .../spec/json/crud/unified/aggregate-let.yml | 3 +- .../crud/v1/read/aggregate-collation.json | 1 + .../json/crud/v1/read/aggregate-collation.yml | 3 +- .../spec/json/crud/v1/read/aggregate-out.json | 1 + .../spec/json/crud/v1/read/aggregate-out.yml | 1 + .../json/crud/v1/read/count-collation.json | 1 + .../json/crud/v1/read/count-collation.yml | 3 +- .../json/crud/v1/read/distinct-collation.json | 1 + .../json/crud/v1/read/distinct-collation.yml | 3 +- .../json/crud/v1/read/find-collation.json | 1 + .../spec/json/crud/v1/read/find-collation.yml | 3 +- .../crud/v1/write/bulkWrite-collation.json | 1 + .../crud/v1/write/bulkWrite-collation.yml | 3 +- .../crud/v1/write/deleteMany-collation.json | 1 + .../crud/v1/write/deleteMany-collation.yml | 3 +- .../crud/v1/write/deleteOne-collation.json | 1 + .../crud/v1/write/deleteOne-collation.yml | 3 +- .../v1/write/findOneAndDelete-collation.json | 1 + .../v1/write/findOneAndDelete-collation.yml | 5 +- .../v1/write/findOneAndReplace-collation.json | 1 + .../v1/write/findOneAndReplace-collation.yml | 3 +- .../v1/write/findOneAndUpdate-collation.json | 1 + .../v1/write/findOneAndUpdate-collation.yml | 5 +- .../crud/v1/write/replaceOne-collation.json | 1 + .../crud/v1/write/replaceOne-collation.yml | 5 +- .../crud/v1/write/updateMany-collation.json | 1 + .../crud/v1/write/updateMany-collation.yml | 3 +- .../crud/v1/write/updateOne-collation.json | 1 + .../crud/v1/write/updateOne-collation.yml | 3 +- .../spec/json/crud/v2/aggregate-merge.json | 415 ------------------ .../spec/json/crud/v2/aggregate-merge.yml | 103 ----- .../crud/v2/aggregate-out-readConcern.json | 385 ---------------- .../crud/v2/aggregate-out-readConcern.yml | 110 ----- .../bulkWrite-arrayFilters-clientError.json | 110 ----- .../v2/bulkWrite-arrayFilters-clientError.yml | 50 --- .../json/crud/v2/bulkWrite-arrayFilters.json | 226 ---------- .../json/crud/v2/bulkWrite-arrayFilters.yml | 103 ----- .../v2/bulkWrite-delete-hint-clientError.json | 150 ------- .../v2/bulkWrite-delete-hint-clientError.yml | 63 --- .../v2/bulkWrite-delete-hint-serverError.json | 209 --------- .../v2/bulkWrite-delete-hint-serverError.yml | 92 ---- .../json/crud/v2/bulkWrite-delete-hint.json | 204 --------- .../json/crud/v2/bulkWrite-delete-hint.yml | 103 ----- .../v2/bulkWrite-update-hint-clientError.json | 235 ---------- .../v2/bulkWrite-update-hint-clientError.yml | 90 ---- .../v2/bulkWrite-update-hint-serverError.json | 343 --------------- .../v2/bulkWrite-update-hint-serverError.yml | 147 ------- .../json/crud/v2/bulkWrite-update-hint.json | 366 --------------- .../json/crud/v2/bulkWrite-update-hint.yml | 164 ------- .../crud/v2/bulkWrite-update-validation.json | 151 ------- .../crud/v2/bulkWrite-update-validation.yml | 75 ---- src/test/spec/json/crud/v2/db-aggregate.json | 81 ---- src/test/spec/json/crud/v2/db-aggregate.yml | 38 -- .../crud/v2/deleteMany-hint-clientError.json | 100 ----- .../crud/v2/deleteMany-hint-clientError.yml | 43 -- .../crud/v2/deleteMany-hint-serverError.json | 141 ------ .../crud/v2/deleteMany-hint-serverError.yml | 62 --- .../spec/json/crud/v2/deleteMany-hint.json | 128 ------ .../spec/json/crud/v2/deleteMany-hint.yml | 58 --- .../crud/v2/deleteOne-hint-clientError.json | 84 ---- .../crud/v2/deleteOne-hint-clientError.yml | 41 -- .../crud/v2/deleteOne-hint-serverError.json | 121 ----- .../crud/v2/deleteOne-hint-serverError.yml | 60 --- .../spec/json/crud/v2/deleteOne-hint.json | 116 ----- src/test/spec/json/crud/v2/deleteOne-hint.yml | 57 --- .../v2/find-allowdiskuse-clientError.json | 40 -- .../crud/v2/find-allowdiskuse-clientError.yml | 28 -- .../v2/find-allowdiskuse-serverError.json | 61 --- .../crud/v2/find-allowdiskuse-serverError.yml | 44 -- .../spec/json/crud/v2/find-allowdiskuse.json | 78 ---- .../spec/json/crud/v2/find-allowdiskuse.yml | 50 --- .../v2/findOneAndDelete-hint-clientError.json | 84 ---- .../v2/findOneAndDelete-hint-clientError.yml | 45 -- .../v2/findOneAndDelete-hint-serverError.json | 113 ----- .../v2/findOneAndDelete-hint-serverError.yml | 60 --- .../json/crud/v2/findOneAndDelete-hint.json | 110 ----- .../json/crud/v2/findOneAndDelete-hint.yml | 56 --- .../findOneAndReplace-hint-clientError.json | 90 ---- .../v2/findOneAndReplace-hint-clientError.yml | 40 -- .../findOneAndReplace-hint-serverError.json | 123 ------ .../v2/findOneAndReplace-hint-serverError.yml | 59 --- .../json/crud/v2/findOneAndReplace-hint.json | 128 ------ .../json/crud/v2/findOneAndReplace-hint.yml | 55 --- .../v2/findOneAndUpdate-hint-clientError.json | 94 ---- .../v2/findOneAndUpdate-hint-clientError.yml | 40 -- .../v2/findOneAndUpdate-hint-serverError.json | 131 ------ .../v2/findOneAndUpdate-hint-serverError.yml | 58 --- .../json/crud/v2/findOneAndUpdate-hint.json | 136 ------ .../json/crud/v2/findOneAndUpdate-hint.yml | 55 --- .../spec/json/crud/v2/replaceOne-hint.json | 146 ------ .../spec/json/crud/v2/replaceOne-hint.yml | 61 --- .../json/crud/v2/replaceOne-validation.json | 41 -- .../json/crud/v2/replaceOne-validation.yml | 21 - ...ged-bulkWrite-delete-hint-clientError.json | 155 ------- ...dged-bulkWrite-delete-hint-clientError.yml | 60 --- ...ged-bulkWrite-update-hint-clientError.json | 245 ----------- ...dged-bulkWrite-update-hint-clientError.yml | 88 ---- ...nowledged-deleteMany-hint-clientError.json | 105 ----- ...knowledged-deleteMany-hint-clientError.yml | 40 -- ...knowledged-deleteOne-hint-clientError.json | 89 ---- ...cknowledged-deleteOne-hint-clientError.yml | 38 -- ...ged-findOneAndDelete-hint-clientError.json | 89 ---- ...dged-findOneAndDelete-hint-clientError.yml | 42 -- ...ed-findOneAndReplace-hint-clientError.json | 95 ---- ...ged-findOneAndReplace-hint-clientError.yml | 40 -- ...ged-findOneAndUpdate-hint-clientError.json | 99 ----- ...dged-findOneAndUpdate-hint-clientError.yml | 40 -- ...nowledged-replaceOne-hint-clientError.json | 99 ----- ...knowledged-replaceOne-hint-clientError.yml | 40 -- ...nowledged-updateMany-hint-clientError.json | 115 ----- ...knowledged-updateMany-hint-clientError.yml | 43 -- ...knowledged-updateOne-hint-clientError.json | 103 ----- ...cknowledged-updateOne-hint-clientError.yml | 40 -- .../crud/v2/updateMany-hint-clientError.json | 110 ----- .../crud/v2/updateMany-hint-clientError.yml | 45 -- .../crud/v2/updateMany-hint-serverError.json | 161 ------- .../crud/v2/updateMany-hint-serverError.yml | 66 --- .../spec/json/crud/v2/updateMany-hint.json | 168 ------- .../spec/json/crud/v2/updateMany-hint.yml | 65 --- .../json/crud/v2/updateMany-validation.json | 57 --- .../json/crud/v2/updateMany-validation.yml | 25 -- .../crud/v2/updateOne-hint-clientError.json | 98 ----- .../crud/v2/updateOne-hint-clientError.yml | 43 -- .../crud/v2/updateOne-hint-serverError.json | 147 ------- .../crud/v2/updateOne-hint-serverError.yml | 62 --- .../spec/json/crud/v2/updateOne-hint.json | 154 ------- src/test/spec/json/crud/v2/updateOne-hint.yml | 61 --- .../json/crud/v2/updateOne-validation.json | 39 -- .../json/crud/v2/updateOne-validation.yml | 21 - .../json/crud/v2/updateWithPipelines.json | 408 ----------------- .../spec/json/crud/v2/updateWithPipelines.yml | 157 ------- src/test/spec/mod.rs | 3 +- src/test/spec/unified_runner/test_runner.rs | 18 +- 138 files changed, 115 insertions(+), 10798 deletions(-) delete mode 100644 src/test/spec/crud_unified.rs delete mode 100644 src/test/spec/crud_v2.rs delete mode 100644 src/test/spec/json/crud/v2/aggregate-merge.json delete mode 100644 src/test/spec/json/crud/v2/aggregate-merge.yml delete mode 100644 src/test/spec/json/crud/v2/aggregate-out-readConcern.json delete mode 100644 src/test/spec/json/crud/v2/aggregate-out-readConcern.yml delete mode 100644 src/test/spec/json/crud/v2/bulkWrite-arrayFilters-clientError.json delete mode 100644 src/test/spec/json/crud/v2/bulkWrite-arrayFilters-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/bulkWrite-arrayFilters.json delete mode 100644 src/test/spec/json/crud/v2/bulkWrite-arrayFilters.yml delete mode 100644 src/test/spec/json/crud/v2/bulkWrite-delete-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/bulkWrite-delete-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/bulkWrite-delete-hint-serverError.json delete mode 100644 src/test/spec/json/crud/v2/bulkWrite-delete-hint-serverError.yml delete mode 100644 src/test/spec/json/crud/v2/bulkWrite-delete-hint.json delete mode 100644 src/test/spec/json/crud/v2/bulkWrite-delete-hint.yml delete mode 100644 src/test/spec/json/crud/v2/bulkWrite-update-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/bulkWrite-update-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/bulkWrite-update-hint-serverError.json delete mode 100644 src/test/spec/json/crud/v2/bulkWrite-update-hint-serverError.yml delete mode 100644 src/test/spec/json/crud/v2/bulkWrite-update-hint.json delete mode 100644 src/test/spec/json/crud/v2/bulkWrite-update-hint.yml delete mode 100644 src/test/spec/json/crud/v2/bulkWrite-update-validation.json delete mode 100644 src/test/spec/json/crud/v2/bulkWrite-update-validation.yml delete mode 100644 src/test/spec/json/crud/v2/db-aggregate.json delete mode 100644 src/test/spec/json/crud/v2/db-aggregate.yml delete mode 100644 src/test/spec/json/crud/v2/deleteMany-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/deleteMany-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/deleteMany-hint-serverError.json delete mode 100644 src/test/spec/json/crud/v2/deleteMany-hint-serverError.yml delete mode 100644 src/test/spec/json/crud/v2/deleteMany-hint.json delete mode 100644 src/test/spec/json/crud/v2/deleteMany-hint.yml delete mode 100644 src/test/spec/json/crud/v2/deleteOne-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/deleteOne-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/deleteOne-hint-serverError.json delete mode 100644 src/test/spec/json/crud/v2/deleteOne-hint-serverError.yml delete mode 100644 src/test/spec/json/crud/v2/deleteOne-hint.json delete mode 100644 src/test/spec/json/crud/v2/deleteOne-hint.yml delete mode 100644 src/test/spec/json/crud/v2/find-allowdiskuse-clientError.json delete mode 100644 src/test/spec/json/crud/v2/find-allowdiskuse-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/find-allowdiskuse-serverError.json delete mode 100644 src/test/spec/json/crud/v2/find-allowdiskuse-serverError.yml delete mode 100644 src/test/spec/json/crud/v2/find-allowdiskuse.json delete mode 100644 src/test/spec/json/crud/v2/find-allowdiskuse.yml delete mode 100644 src/test/spec/json/crud/v2/findOneAndDelete-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/findOneAndDelete-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/findOneAndDelete-hint-serverError.json delete mode 100644 src/test/spec/json/crud/v2/findOneAndDelete-hint-serverError.yml delete mode 100644 src/test/spec/json/crud/v2/findOneAndDelete-hint.json delete mode 100644 src/test/spec/json/crud/v2/findOneAndDelete-hint.yml delete mode 100644 src/test/spec/json/crud/v2/findOneAndReplace-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/findOneAndReplace-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/findOneAndReplace-hint-serverError.json delete mode 100644 src/test/spec/json/crud/v2/findOneAndReplace-hint-serverError.yml delete mode 100644 src/test/spec/json/crud/v2/findOneAndReplace-hint.json delete mode 100644 src/test/spec/json/crud/v2/findOneAndReplace-hint.yml delete mode 100644 src/test/spec/json/crud/v2/findOneAndUpdate-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/findOneAndUpdate-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/findOneAndUpdate-hint-serverError.json delete mode 100644 src/test/spec/json/crud/v2/findOneAndUpdate-hint-serverError.yml delete mode 100644 src/test/spec/json/crud/v2/findOneAndUpdate-hint.json delete mode 100644 src/test/spec/json/crud/v2/findOneAndUpdate-hint.yml delete mode 100644 src/test/spec/json/crud/v2/replaceOne-hint.json delete mode 100644 src/test/spec/json/crud/v2/replaceOne-hint.yml delete mode 100644 src/test/spec/json/crud/v2/replaceOne-validation.json delete mode 100644 src/test/spec/json/crud/v2/replaceOne-validation.yml delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-deleteMany-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-deleteMany-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-deleteOne-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-deleteOne-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-replaceOne-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-replaceOne-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-updateMany-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-updateMany-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-updateOne-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/unacknowledged-updateOne-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/updateMany-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/updateMany-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/updateMany-hint-serverError.json delete mode 100644 src/test/spec/json/crud/v2/updateMany-hint-serverError.yml delete mode 100644 src/test/spec/json/crud/v2/updateMany-hint.json delete mode 100644 src/test/spec/json/crud/v2/updateMany-hint.yml delete mode 100644 src/test/spec/json/crud/v2/updateMany-validation.json delete mode 100644 src/test/spec/json/crud/v2/updateMany-validation.yml delete mode 100644 src/test/spec/json/crud/v2/updateOne-hint-clientError.json delete mode 100644 src/test/spec/json/crud/v2/updateOne-hint-clientError.yml delete mode 100644 src/test/spec/json/crud/v2/updateOne-hint-serverError.json delete mode 100644 src/test/spec/json/crud/v2/updateOne-hint-serverError.yml delete mode 100644 src/test/spec/json/crud/v2/updateOne-hint.json delete mode 100644 src/test/spec/json/crud/v2/updateOne-hint.yml delete mode 100644 src/test/spec/json/crud/v2/updateOne-validation.json delete mode 100644 src/test/spec/json/crud/v2/updateOne-validation.yml delete mode 100644 src/test/spec/json/crud/v2/updateWithPipelines.json delete mode 100644 src/test/spec/json/crud/v2/updateWithPipelines.yml diff --git a/src/selection_criteria.rs b/src/selection_criteria.rs index 3c3ef63be..0ac1dfc49 100644 --- a/src/selection_criteria.rs +++ b/src/selection_criteria.rs @@ -1,5 +1,4 @@ -use std::convert::TryInto; -use std::{collections::HashMap, sync::Arc, time::Duration}; +use std::{collections::HashMap, convert::TryInto, sync::Arc, time::Duration}; use derivative::Derivative; use serde::{de::Error as SerdeError, Deserialize, Deserializer}; diff --git a/src/test/spec/crud_unified.rs b/src/test/spec/crud_unified.rs deleted file mode 100644 index a897f17ea..000000000 --- a/src/test/spec/crud_unified.rs +++ /dev/null @@ -1,15 +0,0 @@ -use tokio::sync::RwLockWriteGuard; - -use crate::test::{run_spec_test, spec::run_unified_format_test, LOCK}; - -// The drop implementation on FailPointGuard blocks in the foreground, so we need to use the -// multi-thread runtime to avoid panicking. -#[cfg_attr( - feature = "tokio-runtime", - tokio::test(flavor = "multi_thread", worker_threads = 1) -)] -#[cfg_attr(feature = "async-std-runtime", async_std::test)] -async fn run() { - let _guard: RwLockWriteGuard<()> = LOCK.run_exclusively().await; - run_spec_test(&["crud", "unified"], run_unified_format_test).await; -} diff --git a/src/test/spec/crud_v2.rs b/src/test/spec/crud_v2.rs deleted file mode 100644 index 3b1de7e97..000000000 --- a/src/test/spec/crud_v2.rs +++ /dev/null @@ -1,12 +0,0 @@ -use tokio::sync::RwLockWriteGuard; - -use crate::test::{run_spec_test, LOCK}; - -use super::run_v2_test; - -#[cfg_attr(feature = "tokio-runtime", tokio::test)] -#[cfg_attr(feature = "async-std-runtime", async_std::test)] -async fn run() { - let _guard: RwLockWriteGuard<()> = LOCK.run_exclusively().await; - run_spec_test(&["crud", "v2"], run_v2_test).await; -} diff --git a/src/test/spec/json/crud/README.rst b/src/test/spec/json/crud/README.rst index 864290e9b..b3d251299 100644 --- a/src/test/spec/json/crud/README.rst +++ b/src/test/spec/json/crud/README.rst @@ -19,118 +19,19 @@ version requirements as noted by the ``runOn`` section, if provided. Subdirectories for Test Formats ------------------------------- -This document describes two legacy formats for CRUD tests: legacy-v1, which dates back -to the first version of the CRUD specification, and legacy-v2, which was an update to -the initial format. New CRUD tests should be written in the `unified test format <../../../../unified-test-format/unified-test-format.rst>`_ +This document describes a legacy format for CRUD tests: legacy-v1, which dates back +to the first version of the CRUD specification. New CRUD tests should be written +in the `unified test format <../../unified-test-format/unified-test-format.rst>`_ and placed under ``unified/``. Until such time that all original tests have been ported to the unified test format, tests in each format will be grouped in their own subdirectory: - ``v1/``: Legacy-v1 format tests -- ``v2/``: Legacy-v2 format tests -- ``unified/``: Tests using the `unified test format <../../../../unified-test-format/unified-test-format.rst>`_ +- ``unified/``: Tests using the `unified test format <../../unified-test-format/unified-test-format.rst>`_ Since some drivers may not have a unified test runner capable of executing tests -in all three formats, segregating tests in this manner will make it easier for +in all two formats, segregating tests in this manner will make it easier for drivers to sync and feed test files to different test runners. -Legacy-v2 Test Format -===================== - -*Note: this section pertains to test files in the "v2" directory.* - -Each YAML file has the following keys: - -- ``runOn`` (optional): An array of server version and/or topology requirements - for which the tests can be run. If the test environment satisfies one or more - of these requirements, the tests may be executed; otherwise, this file should - be skipped. If this field is omitted, the tests can be assumed to have no - particular requirements and should be executed. Each element will have some or - all of the following fields: - - - ``minServerVersion`` (optional): The minimum server version (inclusive) - required to successfully run the tests. If this field is omitted, it should - be assumed that there is no lower bound on the required server version. - - - ``maxServerVersion`` (optional): The maximum server version (inclusive) - against which the tests can be run successfully. If this field is omitted, - it should be assumed that there is no upper bound on the required server - version. - - - ``topology`` (optional): An array of server topologies against which the - tests can be run successfully. Valid topologies are "single", "replicaset", - and "sharded". If this field is omitted, the default is all topologies (i.e. - ``["single", "replicaset", "sharded"]``). - -- ``collection_name`` (optional): The collection to use for testing. - -- ``database_name`` (optional): The database to use for testing. - -- ``data`` (optional): The data that should exist in the collection under test before each - test run. - -- ``tests``: An array of tests that are to be run independently of each other. - Each test will have some or all of the following fields: - - - ``description``: The name of the test. - - - ``skipReason`` (optional): If present, the test should be skipped and the - string value will specify a reason. - - - ``failPoint`` (optional): The ``configureFailPoint`` command document to run - to configure a fail point on the primary server. - - - ``clientOptions`` (optional): Names and values of options used to construct - the MongoClient for this test. - - - ``operations``: Array of documents, each describing an operation to be - executed. Each document has the following fields: - - - ``object`` (optional): The name of the object to perform the operation on. Can be - "database" or "collection". Defaults to "collection" if undefined. - - - ``collectionOptions`` (optional): Names and values of options used to - construct the collection object for this test. - - - ``name``: The name of the operation as defined in the specification. - - - ``arguments``: The names and values of arguments from the specification. - - - ``error`` (optional): If ``true``, the test should expect the operation - to emit an error or exception. If ``false`` or omitted, drivers MUST - assert that no error occurred. - - - ``result`` (optional): The result of executing the operation. This will - correspond to operation's return value as defined in the specification. - This field may be omitted if ``error`` is ``true``. If this field is - present and ``error`` is ``true`` (generally for multi-statement tests), - the result reports information about statements that succeeded before an - unrecoverable failure. In that case, drivers may choose to check the - result object if their BulkWriteException (or equivalent) provides access - to a write result object. - - - ``expectations`` (optional): Array of documents, each describing a - `CommandStartedEvent <../../command-monitoring/command-monitoring.rst#api>`_ - from the - `Command Monitoring <../../command-monitoring/command-monitoring.rst>`_ - specification. If present, drivers should use command monitoring to observe - events emitted during execution of the test operation(s) and assert that - they match the expected CommandStartedEvent(s). Each document will have the - following field: - - - ``command_started_event``: Document corresponding to an expected - `CommandStartedEvent <../../command-monitoring/command-monitoring.rst#api>`_. - - - ``outcome`` (optional): Document describing the expected state of the - collection after the operation is executed. Contains the following fields: - - - ``collection``: - - - ``name`` (optional): The name of the collection to verify. If this isn't - present then use the collection under test. - - - ``data``: The data that should exist in the collection after the - operation has been run, sorted by "_id". - Legacy-v1 Test Format for Single Operations ------------------------------------------- @@ -151,11 +52,13 @@ single operation. Notable differences from the legacy-v2 format are as follows: fields. - Instead of a top-level ``runOn`` field, server requirements are denoted by - separate top-level ``minServerVersion`` and ``maxServerVersion`` fields. The - minimum server version is an inclusive lower bound for running the test. The - maximum server version is an exclusive upper bound for running the test. If a - field is not present, it should be assumed that there is no corresponding bound - on the required server version. + separate top-level ``minServerVersion``, ``maxServerVersion``, and + ``serverless`` fields. The minimum server version is an inclusive lower bound + for running the test. The maximum server version is an exclusive upper bound + for running the test. If a field is not present, it should be assumed that + there is no corresponding bound on the required server version. The + ``serverless`` requirement behaves the same as the ``serverless`` field of the + `unified test format's runOnRequirement <../../unified-test-format/unified-test-format.rst#runonrequirement>`_. The legacy-v1 format should not conflict with the newer, multi-operation format used by other specs (e.g. Transactions). It is possible to create a unified test @@ -173,8 +76,8 @@ messages into the bulk write exception's top-level message. Test Runner Implementation ========================== -This section provides guidance for implementing a test runner for legacy-v1 and -legacy-v2 tests. See the `unified test format spec <../../../../unified-test-format/unified-test-format.rst>`_ for how to run tests under +This section provides guidance for implementing a test runner for legacy-v1 +tests. See the `unified test format spec <../../../../unified-test-format/unified-test-format.rst>`_ for how to run tests under ``unified/``. Before running the tests: @@ -219,8 +122,8 @@ For each test file: - Activate command monitoring for ``localMongoClient`` and begin capturing events. Note that some events may need to be filtered out if the driver - uses global listeners or reports internal commands (e.g. ``isMaster``, - authentication). + uses global listeners or reports internal commands (e.g. ``hello``, legacy + hello, authentication). - For each element in the ``operations`` array: @@ -313,9 +216,13 @@ Prose Tests The following tests have not yet been automated, but MUST still be tested. -"errInfo" is propagated ------------------------ -Test that a writeConcernError "errInfo" is propagated to the user in whatever way is idiomatic to the driver (exception, error object, etc.). Using a 4.0+ server, set the following failpoint: +1. WriteConcernError.details exposes writeConcernError.errInfo +-------------------------------------------------------------- + +Test that ``writeConcernError.errInfo`` in a command response is propagated as +``WriteConcernError.details`` (or equivalent) in the driver. + +Using a 4.0+ server, set the following failpoint: .. code:: javascript @@ -338,4 +245,34 @@ Test that a writeConcernError "errInfo" is propagated to the user in whatever wa }, "mode": { "times": 1 } } -Then, perform an insert on the same database. Assert that an error occurs and that the "errInfo" is accessible and matches the one set in the failpoint. \ No newline at end of file + +Then, perform an insert operation and assert that a WriteConcernError occurs and +that its ``details`` property is both accessible and matches the ``errInfo`` +object from the failpoint. + +2. WriteError.details exposes writeErrors[].errInfo +--------------------------------------------------- + +Test that ``writeErrors[].errInfo`` in a command response is propagated as +``WriteError.details`` (or equivalent) in the driver. + +Using a 5.0+ server, create a collection with +`document validation `_ +like so: + +.. code:: javascript + + { + "create": "test", + "validator": { + "x": { $type: "string" } + } + } + +Enable `command monitoring <../../command-monitoring/command-monitoring.rst>`_ +to observe CommandSucceededEvents. Then, insert an invalid document (e.g. +``{x: 1}``) and assert that a WriteError occurs, that its code is ``121`` +(i.e. DocumentValidationFailure), and that its ``details`` property is +accessible. Additionally, assert that a CommandSucceededEvent was observed and +that the ``writeErrors[0].errInfo`` field in the response document matches the +WriteError's ``details`` property. diff --git a/src/test/spec/json/crud/unified/aggregate-let.json b/src/test/spec/json/crud/unified/aggregate-let.json index 4ce8256cb..d3b76bd65 100644 --- a/src/test/spec/json/crud/unified/aggregate-let.json +++ b/src/test/spec/json/crud/unified/aggregate-let.json @@ -1,6 +1,6 @@ { "description": "aggregate-let", - "schemaVersion": "1.0", + "schemaVersion": "1.4", "createEntities": [ { "client": { @@ -310,7 +310,8 @@ "description": "Aggregate to collection with let option", "runOnRequirements": [ { - "minServerVersion": "5.0" + "minServerVersion": "5.0", + "serverless": "forbid" } ], "operations": [ diff --git a/src/test/spec/json/crud/unified/aggregate-let.yml b/src/test/spec/json/crud/unified/aggregate-let.yml index ed34c37c4..80da3d90b 100644 --- a/src/test/spec/json/crud/unified/aggregate-let.yml +++ b/src/test/spec/json/crud/unified/aggregate-let.yml @@ -1,6 +1,6 @@ description: "aggregate-let" -schemaVersion: "1.0" +schemaVersion: "1.4" createEntities: - client: @@ -126,6 +126,7 @@ tests: - description: "Aggregate to collection with let option" runOnRequirements: - minServerVersion: "5.0" + serverless: "forbid" operations: - name: aggregate object: *collection0 diff --git a/src/test/spec/json/crud/v1/read/aggregate-collation.json b/src/test/spec/json/crud/v1/read/aggregate-collation.json index 85662a442..d958e447b 100644 --- a/src/test/spec/json/crud/v1/read/aggregate-collation.json +++ b/src/test/spec/json/crud/v1/read/aggregate-collation.json @@ -6,6 +6,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "Aggregate with collation", diff --git a/src/test/spec/json/crud/v1/read/aggregate-collation.yml b/src/test/spec/json/crud/v1/read/aggregate-collation.yml index d526db6d1..24cafd24b 100644 --- a/src/test/spec/json/crud/v1/read/aggregate-collation.yml +++ b/src/test/spec/json/crud/v1/read/aggregate-collation.yml @@ -1,6 +1,7 @@ data: - {_id: 1, x: 'ping'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -11,7 +12,7 @@ tests: pipeline: - $match: x: 'PING' - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: - {_id: 1, x: 'ping'} diff --git a/src/test/spec/json/crud/v1/read/aggregate-out.json b/src/test/spec/json/crud/v1/read/aggregate-out.json index 4e33f9288..c195e163e 100644 --- a/src/test/spec/json/crud/v1/read/aggregate-out.json +++ b/src/test/spec/json/crud/v1/read/aggregate-out.json @@ -14,6 +14,7 @@ } ], "minServerVersion": "2.6", + "serverless": "forbid", "tests": [ { "description": "Aggregate with $out", diff --git a/src/test/spec/json/crud/v1/read/aggregate-out.yml b/src/test/spec/json/crud/v1/read/aggregate-out.yml index 893b7fe44..d6688dd08 100644 --- a/src/test/spec/json/crud/v1/read/aggregate-out.yml +++ b/src/test/spec/json/crud/v1/read/aggregate-out.yml @@ -3,6 +3,7 @@ data: - {_id: 2, x: 22} - {_id: 3, x: 33} minServerVersion: '2.6' +serverless: 'forbid' tests: - diff --git a/src/test/spec/json/crud/v1/read/count-collation.json b/src/test/spec/json/crud/v1/read/count-collation.json index 6f75282fe..7d6150849 100644 --- a/src/test/spec/json/crud/v1/read/count-collation.json +++ b/src/test/spec/json/crud/v1/read/count-collation.json @@ -6,6 +6,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "Count documents with collation", diff --git a/src/test/spec/json/crud/v1/read/count-collation.yml b/src/test/spec/json/crud/v1/read/count-collation.yml index a463a7aa0..02da74c6b 100644 --- a/src/test/spec/json/crud/v1/read/count-collation.yml +++ b/src/test/spec/json/crud/v1/read/count-collation.yml @@ -1,6 +1,7 @@ data: - {_id: 1, x: 'PING'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -9,7 +10,7 @@ tests: name: countDocuments arguments: filter: { x: 'ping' } - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: 1 diff --git a/src/test/spec/json/crud/v1/read/distinct-collation.json b/src/test/spec/json/crud/v1/read/distinct-collation.json index 0af0c67cb..984991a43 100644 --- a/src/test/spec/json/crud/v1/read/distinct-collation.json +++ b/src/test/spec/json/crud/v1/read/distinct-collation.json @@ -10,6 +10,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "Distinct with a collation", diff --git a/src/test/spec/json/crud/v1/read/distinct-collation.yml b/src/test/spec/json/crud/v1/read/distinct-collation.yml index 08bd6a929..33b57d992 100644 --- a/src/test/spec/json/crud/v1/read/distinct-collation.yml +++ b/src/test/spec/json/crud/v1/read/distinct-collation.yml @@ -2,6 +2,7 @@ data: - {_id: 1, string: 'PING'} - {_id: 2, string: 'ping'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -10,7 +11,7 @@ tests: name: distinct arguments: fieldName: "string" - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: diff --git a/src/test/spec/json/crud/v1/read/find-collation.json b/src/test/spec/json/crud/v1/read/find-collation.json index 53d0e9490..4e56c0525 100644 --- a/src/test/spec/json/crud/v1/read/find-collation.json +++ b/src/test/spec/json/crud/v1/read/find-collation.json @@ -6,6 +6,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "Find with a collation", diff --git a/src/test/spec/json/crud/v1/read/find-collation.yml b/src/test/spec/json/crud/v1/read/find-collation.yml index a014dc251..baac5add4 100644 --- a/src/test/spec/json/crud/v1/read/find-collation.yml +++ b/src/test/spec/json/crud/v1/read/find-collation.yml @@ -1,6 +1,7 @@ data: - {_id: 1, x: 'ping'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -9,7 +10,7 @@ tests: name: "find" arguments: filter: {x: 'PING'} - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: - {_id: 1, x: 'ping'} diff --git a/src/test/spec/json/crud/v1/write/bulkWrite-collation.json b/src/test/spec/json/crud/v1/write/bulkWrite-collation.json index 8e9d1bcb1..bc90aa817 100644 --- a/src/test/spec/json/crud/v1/write/bulkWrite-collation.json +++ b/src/test/spec/json/crud/v1/write/bulkWrite-collation.json @@ -22,6 +22,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "BulkWrite with delete operations and collation", diff --git a/src/test/spec/json/crud/v1/write/bulkWrite-collation.yml b/src/test/spec/json/crud/v1/write/bulkWrite-collation.yml index 217c69116..5aff22eed 100644 --- a/src/test/spec/json/crud/v1/write/bulkWrite-collation.yml +++ b/src/test/spec/json/crud/v1/write/bulkWrite-collation.yml @@ -6,8 +6,9 @@ data: - {_id: 5, x: 'pONg'} minServerVersion: '3.4' +serverless: 'forbid' -# See: https://docs.mongodb.com/master/reference/collation/#collation-document +# See: https://docs.mongodb.com/manual/reference/collation/#collation-document tests: - description: "BulkWrite with delete operations and collation" diff --git a/src/test/spec/json/crud/v1/write/deleteMany-collation.json b/src/test/spec/json/crud/v1/write/deleteMany-collation.json index d17bf3bcb..fce75e488 100644 --- a/src/test/spec/json/crud/v1/write/deleteMany-collation.json +++ b/src/test/spec/json/crud/v1/write/deleteMany-collation.json @@ -14,6 +14,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "DeleteMany when many documents match with collation", diff --git a/src/test/spec/json/crud/v1/write/deleteMany-collation.yml b/src/test/spec/json/crud/v1/write/deleteMany-collation.yml index daca5dd4c..2b0ef9db9 100644 --- a/src/test/spec/json/crud/v1/write/deleteMany-collation.yml +++ b/src/test/spec/json/crud/v1/write/deleteMany-collation.yml @@ -3,6 +3,7 @@ data: - {_id: 2, x: 'ping'} - {_id: 3, x: 'pINg'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -12,7 +13,7 @@ tests: arguments: filter: x: 'PING' - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: diff --git a/src/test/spec/json/crud/v1/write/deleteOne-collation.json b/src/test/spec/json/crud/v1/write/deleteOne-collation.json index 2f7f92113..9bcef411e 100644 --- a/src/test/spec/json/crud/v1/write/deleteOne-collation.json +++ b/src/test/spec/json/crud/v1/write/deleteOne-collation.json @@ -14,6 +14,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "DeleteOne when many documents matches with collation", diff --git a/src/test/spec/json/crud/v1/write/deleteOne-collation.yml b/src/test/spec/json/crud/v1/write/deleteOne-collation.yml index 321a14885..d37ecf76d 100644 --- a/src/test/spec/json/crud/v1/write/deleteOne-collation.yml +++ b/src/test/spec/json/crud/v1/write/deleteOne-collation.yml @@ -3,6 +3,7 @@ data: - {_id: 2, x: 'ping'} - {_id: 3, x: 'pINg'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -11,7 +12,7 @@ tests: name: "deleteOne" arguments: filter: {x: 'PING'} - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: diff --git a/src/test/spec/json/crud/v1/write/findOneAndDelete-collation.json b/src/test/spec/json/crud/v1/write/findOneAndDelete-collation.json index 1ff37d2e8..32480da84 100644 --- a/src/test/spec/json/crud/v1/write/findOneAndDelete-collation.json +++ b/src/test/spec/json/crud/v1/write/findOneAndDelete-collation.json @@ -14,6 +14,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "FindOneAndDelete when one document matches with collation", diff --git a/src/test/spec/json/crud/v1/write/findOneAndDelete-collation.yml b/src/test/spec/json/crud/v1/write/findOneAndDelete-collation.yml index d33741f57..5f13b7e5b 100644 --- a/src/test/spec/json/crud/v1/write/findOneAndDelete-collation.yml +++ b/src/test/spec/json/crud/v1/write/findOneAndDelete-collation.yml @@ -3,6 +3,7 @@ data: - {_id: 2, x: 'ping'} - {_id: 3, x: 'pINg'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -13,11 +14,11 @@ tests: filter: {_id: 2, x: 'PING'} projection: {x: 1, _id: 0} sort: {x: 1} - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: {x: 'ping'} collection: data: - {_id: 1, x: 11} - - {_id: 3, x: 'pINg'} \ No newline at end of file + - {_id: 3, x: 'pINg'} diff --git a/src/test/spec/json/crud/v1/write/findOneAndReplace-collation.json b/src/test/spec/json/crud/v1/write/findOneAndReplace-collation.json index babb2f7c1..9b3c25005 100644 --- a/src/test/spec/json/crud/v1/write/findOneAndReplace-collation.json +++ b/src/test/spec/json/crud/v1/write/findOneAndReplace-collation.json @@ -10,6 +10,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "FindOneAndReplace when one document matches with collation returning the document after modification", diff --git a/src/test/spec/json/crud/v1/write/findOneAndReplace-collation.yml b/src/test/spec/json/crud/v1/write/findOneAndReplace-collation.yml index 040661d75..206ac829c 100644 --- a/src/test/spec/json/crud/v1/write/findOneAndReplace-collation.yml +++ b/src/test/spec/json/crud/v1/write/findOneAndReplace-collation.yml @@ -2,6 +2,7 @@ data: - {_id: 1, x: 11} - {_id: 2, x: 'ping'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -14,7 +15,7 @@ tests: projection: {x: 1, _id: 0} returnDocument: After sort: {x: 1} - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: {x: 'pong'} diff --git a/src/test/spec/json/crud/v1/write/findOneAndUpdate-collation.json b/src/test/spec/json/crud/v1/write/findOneAndUpdate-collation.json index 04c1fe73e..8abab7bd6 100644 --- a/src/test/spec/json/crud/v1/write/findOneAndUpdate-collation.json +++ b/src/test/spec/json/crud/v1/write/findOneAndUpdate-collation.json @@ -14,6 +14,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "FindOneAndUpdate when many documents match with collation returning the document before modification", diff --git a/src/test/spec/json/crud/v1/write/findOneAndUpdate-collation.yml b/src/test/spec/json/crud/v1/write/findOneAndUpdate-collation.yml index 201f2751c..1c50e86be 100644 --- a/src/test/spec/json/crud/v1/write/findOneAndUpdate-collation.yml +++ b/src/test/spec/json/crud/v1/write/findOneAndUpdate-collation.yml @@ -3,6 +3,7 @@ data: - {_id: 2, x: 'ping'} - {_id: 3, x: 'pINg'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -16,7 +17,7 @@ tests: $set: {x: 'pong'} projection: {x: 1, _id: 0} sort: {_id: 1} - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: {x: 'ping'} @@ -24,4 +25,4 @@ tests: data: - {_id: 1, x: 11} - {_id: 2, x: 'pong'} - - {_id: 3, x: 'pINg'} \ No newline at end of file + - {_id: 3, x: 'pINg'} diff --git a/src/test/spec/json/crud/v1/write/replaceOne-collation.json b/src/test/spec/json/crud/v1/write/replaceOne-collation.json index a668fe738..fa4cbe997 100644 --- a/src/test/spec/json/crud/v1/write/replaceOne-collation.json +++ b/src/test/spec/json/crud/v1/write/replaceOne-collation.json @@ -10,6 +10,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "ReplaceOne when one document matches with collation", diff --git a/src/test/spec/json/crud/v1/write/replaceOne-collation.yml b/src/test/spec/json/crud/v1/write/replaceOne-collation.yml index 6861092bb..715cdce84 100644 --- a/src/test/spec/json/crud/v1/write/replaceOne-collation.yml +++ b/src/test/spec/json/crud/v1/write/replaceOne-collation.yml @@ -2,6 +2,7 @@ data: - {_id: 1, x: 11} - {_id: 2, x: 'ping'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -11,7 +12,7 @@ tests: arguments: filter: {x: 'PING'} replacement: {_id: 2, x: 'pong'} - collation: {locale: 'en_US', strength: 2} # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: {locale: 'en_US', strength: 2} # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: @@ -21,4 +22,4 @@ tests: collection: data: - {_id: 1, x: 11} - - {_id: 2, x: 'pong'} \ No newline at end of file + - {_id: 2, x: 'pong'} diff --git a/src/test/spec/json/crud/v1/write/updateMany-collation.json b/src/test/spec/json/crud/v1/write/updateMany-collation.json index 3cb49f229..8becfd806 100644 --- a/src/test/spec/json/crud/v1/write/updateMany-collation.json +++ b/src/test/spec/json/crud/v1/write/updateMany-collation.json @@ -14,6 +14,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "UpdateMany when many documents match with collation", diff --git a/src/test/spec/json/crud/v1/write/updateMany-collation.yml b/src/test/spec/json/crud/v1/write/updateMany-collation.yml index 2d48a9dcf..5a7048f09 100644 --- a/src/test/spec/json/crud/v1/write/updateMany-collation.yml +++ b/src/test/spec/json/crud/v1/write/updateMany-collation.yml @@ -3,6 +3,7 @@ data: - {_id: 2, x: 'ping'} - {_id: 3, x: 'pINg'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -14,7 +15,7 @@ tests: x: 'ping' update: $set: {x: 'pong'} - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: diff --git a/src/test/spec/json/crud/v1/write/updateOne-collation.json b/src/test/spec/json/crud/v1/write/updateOne-collation.json index c49112d51..3afdb83e0 100644 --- a/src/test/spec/json/crud/v1/write/updateOne-collation.json +++ b/src/test/spec/json/crud/v1/write/updateOne-collation.json @@ -10,6 +10,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "UpdateOne when one document matches with collation", diff --git a/src/test/spec/json/crud/v1/write/updateOne-collation.yml b/src/test/spec/json/crud/v1/write/updateOne-collation.yml index 468e94674..0132152b0 100644 --- a/src/test/spec/json/crud/v1/write/updateOne-collation.yml +++ b/src/test/spec/json/crud/v1/write/updateOne-collation.yml @@ -2,6 +2,7 @@ data: - {_id: 1, x: 11} - {_id: 2, x: 'ping'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -12,7 +13,7 @@ tests: filter: {x: 'PING'} update: $set: {x: 'pong'} - collation: { locale: 'en_US', strength: 2} # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2} # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: diff --git a/src/test/spec/json/crud/v2/aggregate-merge.json b/src/test/spec/json/crud/v2/aggregate-merge.json deleted file mode 100644 index c61736a0b..000000000 --- a/src/test/spec/json/crud/v2/aggregate-merge.json +++ /dev/null @@ -1,415 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.11" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "collection_name": "test_aggregate_merge", - "tests": [ - { - "description": "Aggregate with $merge", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_merge", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ] - } - } - } - ], - "outcome": { - "collection": { - "name": "other_test_collection", - "data": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "Aggregate with $merge and batch size of 0", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ], - "batchSize": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_merge", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ], - "cursor": {} - } - } - } - ], - "outcome": { - "collection": { - "name": "other_test_collection", - "data": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "Aggregate with $merge and majority readConcern", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_merge", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ], - "readConcern": { - "level": "majority" - } - } - } - } - ], - "outcome": { - "collection": { - "name": "other_test_collection", - "data": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "Aggregate with $merge and local readConcern", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "collectionOptions": { - "readConcern": { - "level": "local" - } - }, - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_merge", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ], - "readConcern": { - "level": "local" - } - } - } - } - ], - "outcome": { - "collection": { - "name": "other_test_collection", - "data": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "Aggregate with $merge and available readConcern", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "collectionOptions": { - "readConcern": { - "level": "available" - } - }, - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_merge", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ], - "readConcern": { - "level": "available" - } - } - } - } - ], - "outcome": { - "collection": { - "name": "other_test_collection", - "data": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/aggregate-merge.yml b/src/test/spec/json/crud/v2/aggregate-merge.yml deleted file mode 100644 index 5bc5c68ac..000000000 --- a/src/test/spec/json/crud/v2/aggregate-merge.yml +++ /dev/null @@ -1,103 +0,0 @@ -runOn: - - - minServerVersion: "4.1.11" - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - -collection_name: &collection_name 'test_aggregate_merge' - -tests: - - - description: "Aggregate with $merge" - operations: - - - object: collection - name: aggregate - arguments: &arguments - pipeline: &pipeline - - $sort: { x : 1 } - - $match: { _id: { $gt: 1 } } - - $merge: { into: &output_collection "other_test_collection" } - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: *pipeline - outcome: &outcome - collection: - name: *output_collection - data: - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - - - description: "Aggregate with $merge and batch size of 0" - operations: - - - object: collection - name: aggregate - arguments: - <<: *arguments - batchSize: 0 - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: *pipeline - cursor: {} - outcome: *outcome - - - description: "Aggregate with $merge and majority readConcern" - operations: - - - object: collection - name: aggregate - collectionOptions: - readConcern: { level: "majority" } - arguments: *arguments - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: *pipeline - readConcern: { level: "majority" } - outcome: *outcome - - - description: "Aggregate with $merge and local readConcern" - operations: - - - object: collection - name: aggregate - collectionOptions: - readConcern: { level: "local" } - arguments: *arguments - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: *pipeline - readConcern: { level: "local" } - outcome: *outcome - - - description: "Aggregate with $merge and available readConcern" - operations: - - - object: collection - name: aggregate - collectionOptions: - readConcern: { level: "available" } - arguments: *arguments - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: *pipeline - readConcern: { level: "available" } - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/aggregate-out-readConcern.json b/src/test/spec/json/crud/v2/aggregate-out-readConcern.json deleted file mode 100644 index c39ee0e28..000000000 --- a/src/test/spec/json/crud/v2/aggregate-out-readConcern.json +++ /dev/null @@ -1,385 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.0", - "topology": [ - "replicaset", - "sharded" - ] - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "collection_name": "test_aggregate_out_readconcern", - "tests": [ - { - "description": "readConcern majority with out stage", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_out_readconcern", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ], - "readConcern": { - "level": "majority" - } - } - } - } - ], - "outcome": { - "collection": { - "name": "other_test_collection", - "data": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "readConcern local with out stage", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "collectionOptions": { - "readConcern": { - "level": "local" - } - }, - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_out_readconcern", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ], - "readConcern": { - "level": "local" - } - } - } - } - ], - "outcome": { - "collection": { - "name": "other_test_collection", - "data": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "readConcern available with out stage", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "collectionOptions": { - "readConcern": { - "level": "available" - } - }, - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_out_readconcern", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ], - "readConcern": { - "level": "available" - } - } - } - } - ], - "outcome": { - "collection": { - "name": "other_test_collection", - "data": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "readConcern linearizable with out stage", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "collectionOptions": { - "readConcern": { - "level": "linearizable" - } - }, - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ] - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_out_readconcern", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ], - "readConcern": { - "level": "linearizable" - } - } - } - } - ] - }, - { - "description": "invalid readConcern with out stage", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "collectionOptions": { - "readConcern": { - "level": "!invalid123" - } - }, - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ] - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_out_readconcern", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ], - "readConcern": { - "level": "!invalid123" - } - } - } - } - ] - } - ] -} diff --git a/src/test/spec/json/crud/v2/aggregate-out-readConcern.yml b/src/test/spec/json/crud/v2/aggregate-out-readConcern.yml deleted file mode 100644 index 0a864f05e..000000000 --- a/src/test/spec/json/crud/v2/aggregate-out-readConcern.yml +++ /dev/null @@ -1,110 +0,0 @@ -runOn: - - - minServerVersion: "4.1.0" - topology: ["replicaset", "sharded"] - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - -collection_name: &collection_name 'test_aggregate_out_readconcern' - -tests: - - - description: "readConcern majority with out stage" - operations: - - - object: collection - name: aggregate - collectionOptions: - readConcern: { level: "majority" } - arguments: &arguments - pipeline: - - $sort: { x : 1 } - - $match: { _id: { $gt: 1 } } - - $out: &output_collection "other_test_collection" - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: &pipeline - - $sort: { x: 1 } - - $match: { _id: { $gt: 1 } } - - $out: "other_test_collection" - readConcern: { level: "majority" } - outcome: &outcome - collection: - name: *output_collection - data: - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - - - description: "readConcern local with out stage" - operations: - - - object: collection - name: aggregate - collectionOptions: - readConcern: { level: "local" } - arguments: *arguments - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: *pipeline - readConcern: { level: "local" } - outcome: *outcome - - - description: "readConcern available with out stage" - operations: - - - object: collection - name: aggregate - collectionOptions: - readConcern: { level: "available" } - arguments: *arguments - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: *pipeline - readConcern: { level: "available" } - outcome: *outcome - - - description: "readConcern linearizable with out stage" - operations: - - - object: collection - name: aggregate - collectionOptions: - readConcern: { level: "linearizable" } - arguments: *arguments - error: true - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: *pipeline - readConcern: { level: "linearizable" } - - - description: "invalid readConcern with out stage" - operations: - - - object: collection - name: aggregate - collectionOptions: - readConcern: { level: "!invalid123" } - arguments: *arguments - error: true - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: *pipeline - readConcern: { level: "!invalid123" } diff --git a/src/test/spec/json/crud/v2/bulkWrite-arrayFilters-clientError.json b/src/test/spec/json/crud/v2/bulkWrite-arrayFilters-clientError.json deleted file mode 100644 index 22e22f0ef..000000000 --- a/src/test/spec/json/crud/v2/bulkWrite-arrayFilters-clientError.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "runOn": [ - { - "maxServerVersion": "3.5.5" - } - ], - "data": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite on server that doesn't support arrayFilters", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$set": { - "y.0.b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 1 - } - ] - } - } - ], - "options": { - "ordered": true - } - }, - "error": true - } - ], - "expectations": [] - }, - { - "description": "BulkWrite on server that doesn't support arrayFilters with arrayFilters on second op", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$set": { - "y.0.b": 2 - } - } - } - }, - { - "name": "updateMany", - "arguments": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 1 - } - ] - } - } - ], - "options": { - "ordered": true - } - }, - "error": true - } - ], - "expectations": [] - } - ] -} diff --git a/src/test/spec/json/crud/v2/bulkWrite-arrayFilters-clientError.yml b/src/test/spec/json/crud/v2/bulkWrite-arrayFilters-clientError.yml deleted file mode 100644 index 0421ab33e..000000000 --- a/src/test/spec/json/crud/v2/bulkWrite-arrayFilters-clientError.yml +++ /dev/null @@ -1,50 +0,0 @@ -runOn: - - - # arrayFilters support first introduced in 3.5.6 - maxServerVersion: "3.5.5" - -data: - - {_id: 1, y: [{b: 3}, {b: 1}]} - - {_id: 2, y: [{b: 0}, {b: 1}]} - -tests: - - - description: "BulkWrite on server that doesn't support arrayFilters" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - # UpdateOne with with arrayFilters - name: "updateOne" - arguments: - filter: {} - update: { $set: { "y.0.b": 2 } } - arrayFilters: [ { "i.b": 1 } ] - options: { ordered: true } - error: true - expectations: [] - - - description: "BulkWrite on server that doesn't support arrayFilters with arrayFilters on second op" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - # UpdateOne with no arrayFilters - name: "updateOne" - arguments: - filter: {} - update: { $set: { "y.0.b": 2 } } - - - # UpdateMany with arrayFilters - name: "updateMany" - arguments: - filter: {} - update: { $set: { "y.$[i].b": 2 } } - arrayFilters: [ { "i.b": 1 } ] - options: { ordered: true } - error: true - expectations: [] diff --git a/src/test/spec/json/crud/v2/bulkWrite-arrayFilters.json b/src/test/spec/json/crud/v2/bulkWrite-arrayFilters.json deleted file mode 100644 index 2d3ce96de..000000000 --- a/src/test/spec/json/crud/v2/bulkWrite-arrayFilters.json +++ /dev/null @@ -1,226 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "3.5.6" - } - ], - "data": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - } - ], - "collection_name": "test", - "database_name": "crud-tests", - "tests": [ - { - "description": "BulkWrite updateOne with arrayFilters", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 3 - } - ] - } - } - ], - "options": { - "ordered": true - } - }, - "result": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": {}, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": {}, - "u": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 3 - } - ] - } - ], - "ordered": true - }, - "command_name": "update", - "database_name": "crud-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "y": [ - { - "b": 2 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - } - ] - } - } - }, - { - "description": "BulkWrite updateMany with arrayFilters", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "updateMany", - "arguments": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 1 - } - ] - } - } - ], - "options": { - "ordered": true - } - }, - "result": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": {}, - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": {}, - "u": { - "$set": { - "y.$[i].b": 2 - } - }, - "multi": true, - "arrayFilters": [ - { - "i.b": 1 - } - ] - } - ], - "ordered": true - }, - "command_name": "update", - "database_name": "crud-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 2 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 2 - } - ] - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/bulkWrite-arrayFilters.yml b/src/test/spec/json/crud/v2/bulkWrite-arrayFilters.yml deleted file mode 100644 index b3e32e6aa..000000000 --- a/src/test/spec/json/crud/v2/bulkWrite-arrayFilters.yml +++ /dev/null @@ -1,103 +0,0 @@ -runOn: - - - minServerVersion: "3.5.6" - -data: - - {_id: 1, y: [{b: 3}, {b: 1}]} - - {_id: 2, y: [{b: 0}, {b: 1}]} - -collection_name: &collection_name "test" -database_name: &database_name "crud-tests" - -tests: - - - description: "BulkWrite updateOne with arrayFilters" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - # UpdateOne when one document matches arrayFilters - name: "updateOne" - arguments: - filter: {} - update: { $set: { "y.$[i].b": 2 } } - arrayFilters: [ { "i.b": 3 } ] - options: { ordered: true } - result: - deletedCount: 0 - insertedCount: 0 - insertedIds: {} - matchedCount: 1 - modifiedCount: 1 - upsertedCount: 0 - upsertedIds: {} - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: {} - u: { $set: { "y.$[i].b": 2 } } - arrayFilters: [ { "i.b": 3 } ] - ordered: true - # TODO: check that these fields do not exist once - # https://jira.mongodb.org/browse/SPEC-1215 has been resolved. - # writeConcern: null - # bypassDocumentValidation: null - command_name: update - database_name: *database_name - outcome: - collection: - data: - - {_id: 1, y: [{b: 2}, {b: 1}]} - - {_id: 2, y: [{b: 0}, {b: 1}]} - - - description: "BulkWrite updateMany with arrayFilters" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - # UpdateMany when multiple documents match arrayFilters - name: "updateMany" - arguments: - filter: {} - update: { $set: { "y.$[i].b": 2 } } - arrayFilters: [ { "i.b": 1 } ] - options: { ordered: true } - result: - deletedCount: 0 - insertedCount: 0 - insertedIds: {} - matchedCount: 2 - modifiedCount: 2 - upsertedCount: 0 - upsertedIds: {} - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: {} - u: { $set: { "y.$[i].b": 2 } } - multi: true - arrayFilters: [ { "i.b": 1 } ] - ordered: true - # TODO: check that these fields do not exist once - # https://jira.mongodb.org/browse/SPEC-1215 has been resolved. - # writeConcern: null - # bypassDocumentValidation: null - command_name: update - database_name: *database_name - outcome: - collection: - data: - - {_id: 1, y: [{b: 3}, {b: 2}]} - - {_id: 2, y: [{b: 0}, {b: 2}]} diff --git a/src/test/spec/json/crud/v2/bulkWrite-delete-hint-clientError.json b/src/test/spec/json/crud/v2/bulkWrite-delete-hint-clientError.json deleted file mode 100644 index cfeac904c..000000000 --- a/src/test/spec/json/crud/v2/bulkWrite-delete-hint-clientError.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/bulkWrite-delete-hint-clientError.yml b/src/test/spec/json/crud/v2/bulkWrite-delete-hint-clientError.yml deleted file mode 100644 index bbd1a0be5..000000000 --- a/src/test/spec/json/crud/v2/bulkWrite-delete-hint-clientError.yml +++ /dev/null @@ -1,63 +0,0 @@ -runOn: - # Server versions >= 3.4.0 will return an error response for unrecognized - # deleteOne options. These tests check that the driver will raise an error - # if a hint is provided on a server version < 3.4. - - { maxServerVersion: "3.3.99" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - - {_id: 4, x: 44} - -collection_name: &collection_name 'BulkWrite_delete_hint' - -tests: - - - description: "BulkWrite deleteOne with hints unsupported (client-side error)" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "deleteOne" - arguments: - filter: &deleteOne_filter1 { _id: 1 } - hint: &hint_string "_id_" - - - name: "deleteOne" - arguments: - filter: &deleteOne_filter2 { _id: 2 } - hint: &hint_doc { _id: 1 } - options: { ordered: true } - error: true - expectations: [] - outcome: &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: &deleteMany_filter1 { _id: { $lt: 3 } } - hint: *hint_string - - - name: "deleteMany" - arguments: - filter: &deleteMany_filter2 { _id: { $gte: 4 } } - hint: *hint_doc - options: { ordered: true } - error: true - expectations: [] - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/bulkWrite-delete-hint-serverError.json b/src/test/spec/json/crud/v2/bulkWrite-delete-hint-serverError.json deleted file mode 100644 index c68973b0f..000000000 --- a/src/test/spec/json/crud/v2/bulkWrite-delete-hint-serverError.json +++ /dev/null @@ -1,209 +0,0 @@ -{ - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/bulkWrite-delete-hint-serverError.yml b/src/test/spec/json/crud/v2/bulkWrite-delete-hint-serverError.yml deleted file mode 100644 index 72d32dd42..000000000 --- a/src/test/spec/json/crud/v2/bulkWrite-delete-hint-serverError.yml +++ /dev/null @@ -1,92 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Server versions >= 3.4.0 - # raise errors for unknown deleteOne options, and server versions >= 4.3.4 - # support the hint option in deleteOne. - - { 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: &collection_name 'BulkWrite_delete_hint' - -tests: - - - description: "BulkWrite deleteOne with hints unsupported (server-side error)" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "deleteOne" - arguments: - filter: &deleteOne_filter1 { _id: 1 } - hint: &hint_string "_id_" - - - name: "deleteOne" - arguments: - filter: &deleteOne_filter2 { _id: 2 } - hint: &hint_doc { _id: 1 } - options: { ordered: true } - error: true - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *deleteOne_filter1 - hint: *hint_string - limit: 1 - - - q: *deleteOne_filter2 - hint: *hint_doc - limit: 1 - ordered: true - outcome: &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: &deleteMany_filter1 { _id: { $lt: 3 } } - hint: *hint_string - - - name: "deleteMany" - arguments: - filter: &deleteMany_filter2 { _id: { $gte: 4 } } - hint: *hint_doc - options: { ordered: true } - error: true - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *deleteMany_filter1 - hint: *hint_string - limit: 0 - - - q: *deleteMany_filter2 - hint: *hint_doc - limit: 0 - ordered: true - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/bulkWrite-delete-hint.json b/src/test/spec/json/crud/v2/bulkWrite-delete-hint.json deleted file mode 100644 index ece3238fc..000000000 --- a/src/test/spec/json/crud/v2/bulkWrite-delete-hint.json +++ /dev/null @@ -1,204 +0,0 @@ -{ - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/bulkWrite-delete-hint.yml b/src/test/spec/json/crud/v2/bulkWrite-delete-hint.yml deleted file mode 100644 index 671c531e7..000000000 --- a/src/test/spec/json/crud/v2/bulkWrite-delete-hint.yml +++ /dev/null @@ -1,103 +0,0 @@ -runOn: - - { minServerVersion: "4.3.4" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - - {_id: 4, x: 44} - -collection_name: &collection_name 'BulkWrite_delete_hint' - -tests: - - - description: "BulkWrite deleteOne with hints" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "deleteOne" - arguments: - filter: &deleteOne_filter1 { _id: 1 } - hint: &hint_string "_id_" - - - name: "deleteOne" - arguments: - filter: &deleteOne_filter2 { _id: 2 } - hint: &hint_doc { _id: 1 } - options: { ordered: true } - result: - deletedCount: 2 - insertedCount: 0 - insertedIds: {} - matchedCount: 0 - modifiedCount: 0 - upsertedCount: 0 - upsertedIds: {} - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *deleteOne_filter1 - hint: *hint_string - limit: 1 - - - q: *deleteOne_filter2 - hint: *hint_doc - 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: &deleteMany_filter1 { _id: { $lt: 3 } } - hint: *hint_string - - - name: "deleteMany" - arguments: - filter: &deleteMany_filter2 { _id: { $gte: 4 } } - hint: *hint_doc - options: { ordered: true } - result: - deletedCount: 3 - insertedCount: 0 - insertedIds: {} - matchedCount: 0 - modifiedCount: 0 - upsertedCount: 0 - upsertedIds: {} - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *deleteMany_filter1 - hint: *hint_string - limit: 0 - - - q: *deleteMany_filter2 - hint: *hint_doc - limit: 0 - ordered: true - outcome: - collection: - data: - - {_id: 3, x: 33 } diff --git a/src/test/spec/json/crud/v2/bulkWrite-update-hint-clientError.json b/src/test/spec/json/crud/v2/bulkWrite-update-hint-clientError.json deleted file mode 100644 index fa919ec51..000000000 --- a/src/test/spec/json/crud/v2/bulkWrite-update-hint-clientError.json +++ /dev/null @@ -1,235 +0,0 @@ -{ - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/bulkWrite-update-hint-clientError.yml b/src/test/spec/json/crud/v2/bulkWrite-update-hint-clientError.yml deleted file mode 100644 index 9b92b63b8..000000000 --- a/src/test/spec/json/crud/v2/bulkWrite-update-hint-clientError.yml +++ /dev/null @@ -1,90 +0,0 @@ -runOn: - # Server versions >= 3.4.0 will return an error response for unrecognized - # updateOne options. These tests check that the driver will raise an error - # if a hint is provided on a server version < 3.4. - - { maxServerVersion: "3.3.99" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - - {_id: 4, x: 44} - -collection_name: &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: &updateOne_filter { _id: 1 } - update: &updateOne_update { $inc: { x: 1 } } - hint: &hint_string "_id_" - - - name: "updateOne" - arguments: - filter: *updateOne_filter - update: *updateOne_update - hint: &hint_doc { _id: 1 } - options: { ordered: true } - error: true - expectations: [] - outcome: &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: &updateMany_filter { _id: { $lt: 3 } } - update: &updateMany_update { $inc: { x: 1 } } - hint: *hint_string - - - name: "updateMany" - arguments: - filter: *updateMany_filter - update: *updateMany_update - hint: *hint_doc - options: { ordered: true } - error: true - expectations: [] - outcome: *outcome - - - 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: *hint_string - - - name: "replaceOne" - arguments: - filter: { _id: 4 } - replacement: { x: 444 } - hint: *hint_doc - options: { ordered: true } - error: true - expectations: [] - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/bulkWrite-update-hint-serverError.json b/src/test/spec/json/crud/v2/bulkWrite-update-hint-serverError.json deleted file mode 100644 index e8b96fffe..000000000 --- a/src/test/spec/json/crud/v2/bulkWrite-update-hint-serverError.json +++ /dev/null @@ -1,343 +0,0 @@ -{ - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/bulkWrite-update-hint-serverError.yml b/src/test/spec/json/crud/v2/bulkWrite-update-hint-serverError.yml deleted file mode 100644 index 8412b6dd9..000000000 --- a/src/test/spec/json/crud/v2/bulkWrite-update-hint-serverError.yml +++ /dev/null @@ -1,147 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Server versions >= 3.4.0 - # raise errors for unknown updateOne options, and server versions >= 4.2.0 - # support the hint option in updateOne. - - { 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: &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: &updateOne_filter { _id: 1 } - update: &updateOne_update { $inc: { x: 1 } } - hint: &hint_string "_id_" - - - name: "updateOne" - arguments: - filter: *updateOne_filter - update: *updateOne_update - hint: &hint_doc { _id: 1 } - options: { ordered: true } - error: true - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *updateOne_filter - u: *updateOne_update - hint: *hint_string - - - q: *updateOne_filter - u: *updateOne_update - hint: *hint_doc - 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: &updateMany_filter { _id: { $lt: 3 } } - update: &updateMany_update { $inc: { x: 1 } } - hint: *hint_string - - - name: "updateMany" - arguments: - filter: *updateMany_filter - update: *updateMany_update - hint: *hint_doc - options: { ordered: true } - error: true - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *updateMany_filter - u: *updateMany_update - multi: true - hint: *hint_string - - - q: *updateMany_filter - u: *updateMany_update - multi: true - hint: *hint_doc - 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: *hint_string - - - name: "replaceOne" - arguments: - filter: { _id: 4 } - replacement: { x: 444 } - hint: *hint_doc - options: { ordered: true } - error: true - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: { _id: 3 } - u: { x: 333 } - hint: *hint_string - - - q: { _id: 4 } - u: { x: 444 } - hint: *hint_doc - ordered: true - outcome: - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - {_id: 3, x: 33 } - - {_id: 4, x: 44 } diff --git a/src/test/spec/json/crud/v2/bulkWrite-update-hint.json b/src/test/spec/json/crud/v2/bulkWrite-update-hint.json deleted file mode 100644 index 15e169f76..000000000 --- a/src/test/spec/json/crud/v2/bulkWrite-update-hint.json +++ /dev/null @@ -1,366 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.2.0" - } - ], - "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", - "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 - } - }, - "result": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": {}, - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "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": 13 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - } - }, - { - "description": "BulkWrite updateMany with update hints", - "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 - } - }, - "result": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": {}, - "matchedCount": 4, - "modifiedCount": 4, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "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": 13 - }, - { - "_id": 2, - "x": 24 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - } - }, - { - "description": "BulkWrite replaceOne with update hints", - "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 - } - }, - "result": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": {}, - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "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": 333 - }, - { - "_id": 4, - "x": 444 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/bulkWrite-update-hint.yml b/src/test/spec/json/crud/v2/bulkWrite-update-hint.yml deleted file mode 100644 index 0d60a56b6..000000000 --- a/src/test/spec/json/crud/v2/bulkWrite-update-hint.yml +++ /dev/null @@ -1,164 +0,0 @@ -runOn: - - { minServerVersion: "4.2.0" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - - {_id: 4, x: 44} - -collection_name: &collection_name 'test_bulkwrite_update_hint' - -tests: - - - description: "BulkWrite updateOne with update hints" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "updateOne" - arguments: - filter: &updateOne_filter { _id: 1 } - update: &updateOne_update { $inc: { x: 1 } } - hint: &hint_string "_id_" - - - name: "updateOne" - arguments: - filter: *updateOne_filter - update: *updateOne_update - hint: &hint_doc { _id: 1 } - options: { ordered: true } - result: - deletedCount: 0 - insertedCount: 0 - insertedIds: {} - matchedCount: 2 - modifiedCount: 2 - upsertedCount: 0 - upsertedIds: {} - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *updateOne_filter - u: *updateOne_update - hint: *hint_string - - - q: *updateOne_filter - u: *updateOne_update - hint: *hint_doc - ordered: true - outcome: - collection: - data: - - {_id: 1, x: 13 } - - {_id: 2, x: 22 } - - {_id: 3, x: 33 } - - {_id: 4, x: 44 } - - - description: "BulkWrite updateMany with update hints" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "updateMany" - arguments: - filter: &updateMany_filter { _id: { $lt: 3 } } - update: &updateMany_update { $inc: { x: 1 } } - hint: *hint_string - - - name: "updateMany" - arguments: - filter: *updateMany_filter - update: *updateMany_update - hint: *hint_doc - options: { ordered: true } - result: - deletedCount: 0 - insertedCount: 0 - insertedIds: {} - matchedCount: 4 - modifiedCount: 4 - upsertedCount: 0 - upsertedIds: {} - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *updateMany_filter - u: *updateMany_update - multi: true - hint: *hint_string - - - q: *updateMany_filter - u: *updateMany_update - multi: true - hint: *hint_doc - ordered: true - outcome: - collection: - data: - - {_id: 1, x: 13 } - - {_id: 2, x: 24 } - - {_id: 3, x: 33 } - - {_id: 4, x: 44 } - - - description: "BulkWrite replaceOne with update hints" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "replaceOne" - arguments: - filter: { _id: 3 } - replacement: { x: 333 } - hint: *hint_string - - - name: "replaceOne" - arguments: - filter: { _id: 4 } - replacement: { x: 444 } - hint: *hint_doc - options: { ordered: true } - result: - deletedCount: 0 - insertedCount: 0 - insertedIds: {} - matchedCount: 2 - modifiedCount: 2 - upsertedCount: 0 - upsertedIds: {} - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: { _id: 3 } - u: { x: 333 } - hint: *hint_string - - - q: { _id: 4 } - u: { x: 444 } - hint: *hint_doc - ordered: true - outcome: - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - {_id: 3, x: 333 } - - {_id: 4, x: 444 } diff --git a/src/test/spec/json/crud/v2/bulkWrite-update-validation.json b/src/test/spec/json/crud/v2/bulkWrite-update-validation.json deleted file mode 100644 index 481e13c45..000000000 --- a/src/test/spec/json/crud/v2/bulkWrite-update-validation.json +++ /dev/null @@ -1,151 +0,0 @@ -{ - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "tests": [ - { - "description": "BulkWrite replaceOne prohibits atomic modifiers", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "$set": { - "x": 22 - } - } - } - } - ] - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "BulkWrite updateOne requires atomic modifiers", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "x": 22 - } - } - } - ] - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "BulkWrite updateMany requires atomic modifiers", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "x": 44 - } - } - } - ] - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/bulkWrite-update-validation.yml b/src/test/spec/json/crud/v2/bulkWrite-update-validation.yml deleted file mode 100644 index ac11f18b2..000000000 --- a/src/test/spec/json/crud/v2/bulkWrite-update-validation.yml +++ /dev/null @@ -1,75 +0,0 @@ -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - -tests: - - - description: "BulkWrite replaceOne prohibits atomic modifiers" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "replaceOne" - arguments: - filter: { _id: 1 } - # Only the first field is tested, as the spec permits drivers to - # only check that and rely on the server to check subsequent - # fields. - replacement: { $set: { x: 22 }} - error: true - expectations: [] - outcome: - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - {_id: 3, x: 33 } - - - description: "BulkWrite updateOne requires atomic modifiers" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "updateOne" - arguments: - filter: { _id: 1 } - # Only the first field is tested, as the spec permits drivers to - # only check that and rely on the server to check subsequent - # fields. - update: { x: 22 } - error: true - expectations: [] - outcome: - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - {_id: 3, x: 33 } - - - description: "BulkWrite updateMany requires atomic modifiers" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "updateMany" - arguments: - filter: { _id: { $gt: 1 }} - # Only the first field is tested, as the spec permits drivers to - # only check that and rely on the server to check subsequent - # fields. - update: { x: 44 } - error: true - expectations: [] - outcome: - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - {_id: 3, x: 33 } diff --git a/src/test/spec/json/crud/v2/db-aggregate.json b/src/test/spec/json/crud/v2/db-aggregate.json deleted file mode 100644 index d88b9e181..000000000 --- a/src/test/spec/json/crud/v2/db-aggregate.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "3.6.0" - } - ], - "database_name": "admin", - "tests": [ - { - "description": "Aggregate with $listLocalSessions", - "operations": [ - { - "name": "aggregate", - "object": "database", - "arguments": { - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - }, - { - "$addFields": { - "dummy": "dummy field" - } - }, - { - "$project": { - "_id": 0, - "dummy": 1 - } - } - ] - }, - "result": [ - { - "dummy": "dummy field" - } - ] - } - ] - }, - { - "description": "Aggregate with $listLocalSessions and allowDiskUse", - "operations": [ - { - "name": "aggregate", - "object": "database", - "arguments": { - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - }, - { - "$addFields": { - "dummy": "dummy field" - } - }, - { - "$project": { - "_id": 0, - "dummy": 1 - } - } - ], - "allowDiskUse": true - }, - "result": [ - { - "dummy": "dummy field" - } - ] - } - ] - } - ] -} diff --git a/src/test/spec/json/crud/v2/db-aggregate.yml b/src/test/spec/json/crud/v2/db-aggregate.yml deleted file mode 100644 index e9a814858..000000000 --- a/src/test/spec/json/crud/v2/db-aggregate.yml +++ /dev/null @@ -1,38 +0,0 @@ -runOn: - - - minServerVersion: "3.6.0" - -database_name: &database_name "admin" - -tests: - - - description: "Aggregate with $listLocalSessions" - operations: - - - name: aggregate - object: database - arguments: - pipeline: - - $listLocalSessions: { } - - $limit: 1 - - $addFields: { dummy: "dummy field"} - - $project: { _id: 0, dummy: 1} - result: - - - dummy: "dummy field" - - - description: "Aggregate with $listLocalSessions and allowDiskUse" - operations: - - - name: aggregate - object: database - arguments: - pipeline: - - $listLocalSessions: { } - - $limit: 1 - - $addFields: { dummy: "dummy field"} - - $project: { _id: 0, dummy: 1 } - allowDiskUse: true - result: - - - dummy: "dummy field" diff --git a/src/test/spec/json/crud/v2/deleteMany-hint-clientError.json b/src/test/spec/json/crud/v2/deleteMany-hint-clientError.json deleted file mode 100644 index 3a0d02566..000000000 --- a/src/test/spec/json/crud/v2/deleteMany-hint-clientError.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/deleteMany-hint-clientError.yml b/src/test/spec/json/crud/v2/deleteMany-hint-clientError.yml deleted file mode 100644 index fc5f55547..000000000 --- a/src/test/spec/json/crud/v2/deleteMany-hint-clientError.yml +++ /dev/null @@ -1,43 +0,0 @@ -runOn: - # Server versions >= 3.4.0 will return an error response for unrecognized - # deleteMany options. These tests check that the driver will raise an error - # if a hint is provided on a server version < 3.4. - - { maxServerVersion: "3.3.99" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - -collection_name: &collection_name 'DeleteMany_hint' - -tests: - - - description: "DeleteMany with hint string unsupported (client-side error)" - operations: - - - object: collection - name: deleteMany - arguments: - filter: &filter { _id: { $gt: 1 } } - hint: "_id_" - error: true - expectations: [] - outcome: &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: *filter - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/deleteMany-hint-serverError.json b/src/test/spec/json/crud/v2/deleteMany-hint-serverError.json deleted file mode 100644 index 5829e86df..000000000 --- a/src/test/spec/json/crud/v2/deleteMany-hint-serverError.json +++ /dev/null @@ -1,141 +0,0 @@ -{ - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/deleteMany-hint-serverError.yml b/src/test/spec/json/crud/v2/deleteMany-hint-serverError.yml deleted file mode 100644 index b21736091..000000000 --- a/src/test/spec/json/crud/v2/deleteMany-hint-serverError.yml +++ /dev/null @@ -1,62 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Server versions >= 3.4.0 - # raise errors for unknown deleteMany options, and server versions >= 4.3.4 - # support the hint option in deleteMany. - - { minServerVersion: "3.4.0", maxServerVersion: "4.3.3" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - -collection_name: &collection_name 'DeleteMany_hint' - -tests: - - - description: "DeleteMany with hint string unsupported (server-side error)" - operations: - - - object: collection - name: deleteMany - arguments: - filter: &filter { _id: { $gt: 1 } } - hint: "_id_" - error: true - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *filter - hint: "_id_" - limit: 0 - outcome: &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: *filter - hint: { _id: 1 } - error: true - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *filter - hint: { _id: 1 } - limit: 0 - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/deleteMany-hint.json b/src/test/spec/json/crud/v2/deleteMany-hint.json deleted file mode 100644 index 51ee38606..000000000 --- a/src/test/spec/json/crud/v2/deleteMany-hint.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/deleteMany-hint.yml b/src/test/spec/json/crud/v2/deleteMany-hint.yml deleted file mode 100644 index d1d25cff1..000000000 --- a/src/test/spec/json/crud/v2/deleteMany-hint.yml +++ /dev/null @@ -1,58 +0,0 @@ -runOn: - - { minServerVersion: "4.3.4" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - -collection_name: &collection_name 'DeleteMany_hint' - -tests: - - - description: "DeleteMany with hint string" - operations: - - - object: collection - name: deleteMany - arguments: - filter: &filter { _id: { $gt: 1 } } - hint: "_id_" - result: &result - deletedCount: 2 - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *filter - hint: "_id_" - limit: 0 - outcome: &outcome - collection: - data: - - {_id: 1, x: 11 } - - - description: "DeleteMany with hint document" - operations: - - - object: collection - name: deleteMany - arguments: - filter: *filter - hint: { _id: 1 } - result: *result - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *filter - hint: { _id: 1 } - limit: 0 - outcome: *outcome - diff --git a/src/test/spec/json/crud/v2/deleteOne-hint-clientError.json b/src/test/spec/json/crud/v2/deleteOne-hint-clientError.json deleted file mode 100644 index 97f8ec492..000000000 --- a/src/test/spec/json/crud/v2/deleteOne-hint-clientError.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/deleteOne-hint-clientError.yml b/src/test/spec/json/crud/v2/deleteOne-hint-clientError.yml deleted file mode 100644 index cb65d5ff0..000000000 --- a/src/test/spec/json/crud/v2/deleteOne-hint-clientError.yml +++ /dev/null @@ -1,41 +0,0 @@ -runOn: - # Server versions >= 3.4.0 will return an error response for unrecognized - # deleteOne options. These tests check that the driver will raise an error - # if a hint is provided on a server version < 3.4. - - { maxServerVersion: "3.3.99" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'DeleteOne_hint' - -tests: - - - description: "DeleteOne with hint string unsupported (client-side error)" - operations: - - - object: collection - name: deleteOne - arguments: - filter: &filter { _id: 1 } - hint: "_id_" - error: true - expectations: [] - outcome: &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: *filter - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/deleteOne-hint-serverError.json b/src/test/spec/json/crud/v2/deleteOne-hint-serverError.json deleted file mode 100644 index 3cf9400a8..000000000 --- a/src/test/spec/json/crud/v2/deleteOne-hint-serverError.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/deleteOne-hint-serverError.yml b/src/test/spec/json/crud/v2/deleteOne-hint-serverError.yml deleted file mode 100644 index b0158fa04..000000000 --- a/src/test/spec/json/crud/v2/deleteOne-hint-serverError.yml +++ /dev/null @@ -1,60 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Server versions >= 3.4.0 - # raise errors for unknown deleteOne options, and server versions >= 4.3.4 - # support the hint option in deleteOne. - - { minServerVersion: "3.4.0", maxServerVersion: "4.3.3" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'DeleteOne_hint' - -tests: - - - description: "DeleteOne with hint string unsupported (server-side error)" - operations: - - - object: collection - name: deleteOne - arguments: - filter: &filter { _id: 1 } - hint: "_id_" - error: true - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *filter - hint: "_id_" - limit: 1 - outcome: &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: *filter - hint: { _id: 1 } - error: true - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *filter - hint: { _id: 1 } - limit: 1 - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/deleteOne-hint.json b/src/test/spec/json/crud/v2/deleteOne-hint.json deleted file mode 100644 index ec8e7715a..000000000 --- a/src/test/spec/json/crud/v2/deleteOne-hint.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/deleteOne-hint.yml b/src/test/spec/json/crud/v2/deleteOne-hint.yml deleted file mode 100644 index 939ff9e06..000000000 --- a/src/test/spec/json/crud/v2/deleteOne-hint.yml +++ /dev/null @@ -1,57 +0,0 @@ -runOn: - - { minServerVersion: "4.3.4" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - -collection_name: &collection_name 'DeleteOne_hint' - -tests: - - - description: "DeleteOne with hint string" - operations: - - - object: collection - name: deleteOne - arguments: - filter: &filter { _id: 1 } - hint: "_id_" - result: &result - deletedCount: 1 - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *filter - hint: "_id_" - limit: 1 - outcome: &outcome - collection: - data: - - {_id: 2, x: 22 } - - - description: "deleteOne with hint document" - operations: - - - object: collection - name: deleteOne - arguments: - filter: *filter - hint: { _id: 1 } - result: *result - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *filter - hint: { _id: 1 } - limit: 1 - outcome: *outcome - diff --git a/src/test/spec/json/crud/v2/find-allowdiskuse-clientError.json b/src/test/spec/json/crud/v2/find-allowdiskuse-clientError.json deleted file mode 100644 index 5ea013966..000000000 --- a/src/test/spec/json/crud/v2/find-allowdiskuse-clientError.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "runOn": [ - { - "maxServerVersion": "3.0.99" - } - ], - "collection_name": "test_find_allowdiskuse_clienterror", - "tests": [ - { - "description": "Find fails when allowDiskUse true is specified against pre 3.2 server", - "operations": [ - { - "object": "collection", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": true - }, - "error": true - } - ], - "expectations": [] - }, - { - "description": "Find fails when allowDiskUse false is specified against pre 3.2 server", - "operations": [ - { - "object": "collection", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": false - }, - "error": true - } - ], - "expectations": [] - } - ] -} diff --git a/src/test/spec/json/crud/v2/find-allowdiskuse-clientError.yml b/src/test/spec/json/crud/v2/find-allowdiskuse-clientError.yml deleted file mode 100644 index d877b6259..000000000 --- a/src/test/spec/json/crud/v2/find-allowdiskuse-clientError.yml +++ /dev/null @@ -1,28 +0,0 @@ -runOn: - - { maxServerVersion: "3.0.99" } - -collection_name: &collection_name 'test_find_allowdiskuse_clienterror' - -tests: - - - description: "Find fails when allowDiskUse true is specified against pre 3.2 server" - operations: - - - object: collection - name: find - arguments: - filter: { } - allowDiskUse: true - error: true - expectations: [] - - - description: "Find fails when allowDiskUse false is specified against pre 3.2 server" - operations: - - - object: collection - name: find - arguments: - filter: { } - allowDiskUse: false - error: true - expectations: [] diff --git a/src/test/spec/json/crud/v2/find-allowdiskuse-serverError.json b/src/test/spec/json/crud/v2/find-allowdiskuse-serverError.json deleted file mode 100644 index 31aa50e95..000000000 --- a/src/test/spec/json/crud/v2/find-allowdiskuse-serverError.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "3.2", - "maxServerVersion": "4.3.0" - } - ], - "collection_name": "test_find_allowdiskuse_servererror", - "tests": [ - { - "description": "Find fails when allowDiskUse true is specified against pre 4.4 server (server-side error)", - "operations": [ - { - "object": "collection", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": true - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "test_find_allowdiskuse_servererror", - "filter": {}, - "allowDiskUse": true - } - } - } - ] - }, - { - "description": "Find fails when allowDiskUse false is specified against pre 4.4 server (server-side error)", - "operations": [ - { - "object": "collection", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": false - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "test_find_allowdiskuse_servererror", - "filter": {}, - "allowDiskUse": false - } - } - } - ] - } - ] -} diff --git a/src/test/spec/json/crud/v2/find-allowdiskuse-serverError.yml b/src/test/spec/json/crud/v2/find-allowdiskuse-serverError.yml deleted file mode 100644 index 729fbfd0b..000000000 --- a/src/test/spec/json/crud/v2/find-allowdiskuse-serverError.yml +++ /dev/null @@ -1,44 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Server versions >= 3.2.0 - # raise errors for unknown find options, and server versions >= 4.3.1 - # support the allowDiskUse option in find. - - { minServerVersion: "3.2", maxServerVersion: "4.3.0" } - -collection_name: &collection_name 'test_find_allowdiskuse_servererror' - -tests: - - - description: "Find fails when allowDiskUse true is specified against pre 4.4 server (server-side error)" - operations: - - - object: collection - name: find - arguments: - filter: &filter { } - allowDiskUse: true - error: true - expectations: - - - command_started_event: - command: - find: *collection_name - filter: *filter - allowDiskUse: true - - - description: "Find fails when allowDiskUse false is specified against pre 4.4 server (server-side error)" - operations: - - - object: collection - name: find - arguments: - filter: *filter - allowDiskUse: false - error: true - expectations: - - - command_started_event: - command: - find: *collection_name - filter: *filter - allowDiskUse: false diff --git a/src/test/spec/json/crud/v2/find-allowdiskuse.json b/src/test/spec/json/crud/v2/find-allowdiskuse.json deleted file mode 100644 index b2862563b..000000000 --- a/src/test/spec/json/crud/v2/find-allowdiskuse.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.3.1" - } - ], - "collection_name": "test_find_allowdiskuse", - "tests": [ - { - "description": "Find does not send allowDiskuse when value is not specified", - "operations": [ - { - "object": "collection", - "name": "find", - "arguments": { - "filter": {} - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "test_find_allowdiskuse", - "allowDiskUse": null - } - } - } - ] - }, - { - "description": "Find sends allowDiskuse false when false is specified", - "operations": [ - { - "object": "collection", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": false - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "test_find_allowdiskuse", - "allowDiskUse": false - } - } - } - ] - }, - { - "description": "Find sends allowDiskUse true when true is specified", - "operations": [ - { - "object": "collection", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": true - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "test_find_allowdiskuse", - "allowDiskUse": true - } - } - } - ] - } - ] -} diff --git a/src/test/spec/json/crud/v2/find-allowdiskuse.yml b/src/test/spec/json/crud/v2/find-allowdiskuse.yml deleted file mode 100644 index adfc0000e..000000000 --- a/src/test/spec/json/crud/v2/find-allowdiskuse.yml +++ /dev/null @@ -1,50 +0,0 @@ -runOn: - - { minServerVersion: "4.3.1" } - -collection_name: &collection_name 'test_find_allowdiskuse' - -tests: - - - description: "Find does not send allowDiskuse when value is not specified" - operations: - - - object: collection - name: find - arguments: - filter: { } - expectations: - - - command_started_event: - command: - find: *collection_name - allowDiskUse: - - - description: "Find sends allowDiskuse false when false is specified" - operations: - - - object: collection - name: find - arguments: - filter: { } - allowDiskUse: false - expectations: - - - command_started_event: - command: - find: *collection_name - allowDiskUse: false - - - description: "Find sends allowDiskUse true when true is specified" - operations: - - - object: collection - name: find - arguments: - filter: { } - allowDiskUse: true - expectations: - - - command_started_event: - command: - find: *collection_name - allowDiskUse: true diff --git a/src/test/spec/json/crud/v2/findOneAndDelete-hint-clientError.json b/src/test/spec/json/crud/v2/findOneAndDelete-hint-clientError.json deleted file mode 100644 index 262e78ce7..000000000 --- a/src/test/spec/json/crud/v2/findOneAndDelete-hint-clientError.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/findOneAndDelete-hint-clientError.yml b/src/test/spec/json/crud/v2/findOneAndDelete-hint-clientError.yml deleted file mode 100644 index 338faba9d..000000000 --- a/src/test/spec/json/crud/v2/findOneAndDelete-hint-clientError.yml +++ /dev/null @@ -1,45 +0,0 @@ -runOn: - # Server versions >= 4.2.0 will return an error response for unrecognized - # findAndMOdify options. These tests check that the driver will raise an error - # if a hint is provided on a server version < 4.2. - - { maxServerVersion: "4.0.99" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndDelete_hint' - -tests: - - - description: "FindOneAndDelete with hint string unsupported (client-side error)" - operations: - - - object: collection - name: findOneAndDelete - arguments: - filter: &filter { _id: 1 } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "FindOneAndDelete with hint document" - operations: - - - object: collection - name: findOneAndDelete - arguments: - filter: &filter { _id: 1 } - hint: { _id: 1 } - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } diff --git a/src/test/spec/json/crud/v2/findOneAndDelete-hint-serverError.json b/src/test/spec/json/crud/v2/findOneAndDelete-hint-serverError.json deleted file mode 100644 index 9412b36f2..000000000 --- a/src/test/spec/json/crud/v2/findOneAndDelete-hint-serverError.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/findOneAndDelete-hint-serverError.yml b/src/test/spec/json/crud/v2/findOneAndDelete-hint-serverError.yml deleted file mode 100644 index 305ea66ec..000000000 --- a/src/test/spec/json/crud/v2/findOneAndDelete-hint-serverError.yml +++ /dev/null @@ -1,60 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Server versions >= 4.2.0 - # raise errors for unknown findOneAndModify options, and server versions >= 4.3.4 - # support the hint option in findOneAndModify when remove is true. - - { minServerVersion: "4.2.0", maxServerVersion: "4.3.3" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndDelete_hint' - -tests: - - - description: "FindOneAndDelete with hint string unsupported (server-side error)" - operations: - - - object: collection - name: findOneAndDelete - arguments: - filter: &filter { _id: 1 } - hint: "_id_" - error: true - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - hint: "_id_" - remove: true - outcome: &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: &filter { _id: 1 } - hint: { _id: 1 } - error: true - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - hint: { _id: 1 } - remove: true - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } diff --git a/src/test/spec/json/crud/v2/findOneAndDelete-hint.json b/src/test/spec/json/crud/v2/findOneAndDelete-hint.json deleted file mode 100644 index fe8dcfa4c..000000000 --- a/src/test/spec/json/crud/v2/findOneAndDelete-hint.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/findOneAndDelete-hint.yml b/src/test/spec/json/crud/v2/findOneAndDelete-hint.yml deleted file mode 100644 index 9ae087d11..000000000 --- a/src/test/spec/json/crud/v2/findOneAndDelete-hint.yml +++ /dev/null @@ -1,56 +0,0 @@ -runOn: - - { minServerVersion: "4.3.4" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndDelete_hint' - -tests: - - - description: "FindOneAndDelete with hint string" - operations: - - - object: collection - name: findOneAndDelete - arguments: - filter: &filter { _id: 1 } - hint: "_id_" - # original document is returned by default - result: &result { _id: 1, x: 11 } - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - hint: "_id_" - remove: true - outcome: &outcome - collection: - data: - - { _id: 2, x: 22 } - - - description: "FindOneAndDelete with hint document" - operations: - - - object: collection - name: findOneAndDelete - arguments: - filter: &filter { _id: 1 } - hint: { _id: 1 } - # original document is returned by default - result: &result { _id: 1, x: 11 } - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - hint: { _id: 1 } - remove: true - outcome: &outcome - collection: - data: - - { _id: 2, x: 22 } diff --git a/src/test/spec/json/crud/v2/findOneAndReplace-hint-clientError.json b/src/test/spec/json/crud/v2/findOneAndReplace-hint-clientError.json deleted file mode 100644 index 08fd4b3ec..000000000 --- a/src/test/spec/json/crud/v2/findOneAndReplace-hint-clientError.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "runOn": [ - { - "maxServerVersion": "4.0.99" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "findOneAndReplace_hint", - "tests": [ - { - "description": "FindOneAndReplace with hint string unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "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": "FindOneAndReplace with hint document unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/findOneAndReplace-hint-clientError.yml b/src/test/spec/json/crud/v2/findOneAndReplace-hint-clientError.yml deleted file mode 100644 index f50782d33..000000000 --- a/src/test/spec/json/crud/v2/findOneAndReplace-hint-clientError.yml +++ /dev/null @@ -1,40 +0,0 @@ -runOn: - - { maxServerVersion: "4.0.99" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndReplace_hint' - -tests: - - - description: "FindOneAndReplace with hint string unsupported (client-side error)" - operations: - - - object: collection - name: findOneAndReplace - arguments: - filter: &filter { _id: 1 } - replacement: &replacement { x: 33 } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "FindOneAndReplace with hint document unsupported (client-side error)" - operations: - - - object: collection - name: findOneAndReplace - arguments: - filter: *filter - replacement: *replacement - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/findOneAndReplace-hint-serverError.json b/src/test/spec/json/crud/v2/findOneAndReplace-hint-serverError.json deleted file mode 100644 index 6710e6a70..000000000 --- a/src/test/spec/json/crud/v2/findOneAndReplace-hint-serverError.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.3.0" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "findOneAndReplace_hint", - "tests": [ - { - "description": "FindOneAndReplace with hint string unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndReplace_hint", - "query": { - "_id": 1 - }, - "update": { - "x": 33 - }, - "hint": "_id_" - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "FindOneAndReplace with hint document unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndReplace_hint", - "query": { - "_id": 1 - }, - "update": { - "x": 33 - }, - "hint": { - "_id": 1 - } - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/findOneAndReplace-hint-serverError.yml b/src/test/spec/json/crud/v2/findOneAndReplace-hint-serverError.yml deleted file mode 100644 index 41812658a..000000000 --- a/src/test/spec/json/crud/v2/findOneAndReplace-hint-serverError.yml +++ /dev/null @@ -1,59 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Server versions >= 4.1.10 - # raise errors for unknown findAndModify options (SERVER-40005), but the spec - # requires client-side errors for < 4.2. Support for findAndModify hint was - # added in 4.3.1 (SERVER-42099), so we'll allow up to 4.3.0 (inclusive). - - { minServerVersion: "4.2.0", maxServerVersion: "4.3.0" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndReplace_hint' - -tests: - - - description: "FindOneAndReplace with hint string unsupported (server-side error)" - operations: - - - object: collection - name: findOneAndReplace - arguments: - filter: &filter { _id: 1 } - replacement: &replacement { x: 33 } - hint: "_id_" - error: true - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - update: *replacement - hint: "_id_" - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "FindOneAndReplace with hint document unsupported (server-side error)" - operations: - - - object: collection - name: findOneAndReplace - arguments: - filter: *filter - replacement: *replacement - hint: { _id: 1 } - error: true - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - update: *replacement - hint: { _id: 1 } - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/findOneAndReplace-hint.json b/src/test/spec/json/crud/v2/findOneAndReplace-hint.json deleted file mode 100644 index 263fdf962..000000000 --- a/src/test/spec/json/crud/v2/findOneAndReplace-hint.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.3.1" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "findOneAndReplace_hint", - "tests": [ - { - "description": "FindOneAndReplace with hint string", - "operations": [ - { - "object": "collection", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - }, - "hint": "_id_" - }, - "result": { - "_id": 1, - "x": 11 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndReplace_hint", - "query": { - "_id": 1 - }, - "update": { - "x": 33 - }, - "hint": "_id_" - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 33 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "FindOneAndReplace with hint document", - "operations": [ - { - "object": "collection", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - }, - "hint": { - "_id": 1 - } - }, - "result": { - "_id": 1, - "x": 11 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndReplace_hint", - "query": { - "_id": 1 - }, - "update": { - "x": 33 - }, - "hint": { - "_id": 1 - } - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 33 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/findOneAndReplace-hint.yml b/src/test/spec/json/crud/v2/findOneAndReplace-hint.yml deleted file mode 100644 index b585dd867..000000000 --- a/src/test/spec/json/crud/v2/findOneAndReplace-hint.yml +++ /dev/null @@ -1,55 +0,0 @@ -runOn: - - { minServerVersion: "4.3.1" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndReplace_hint' - -tests: - - - description: "FindOneAndReplace with hint string" - operations: - - - object: collection - name: findOneAndReplace - arguments: - filter: &filter { _id: 1 } - replacement: &replacement { x: 33 } - hint: "_id_" - # original document is returned by default - result: &result { _id: 1, x: 11 } - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - update: *replacement - hint: "_id_" - outcome: &outcome - collection: - data: - - { _id: 1, x: 33 } - - { _id: 2, x: 22 } - - - description: "FindOneAndReplace with hint document" - operations: - - - object: collection - name: findOneAndReplace - arguments: - filter: *filter - replacement: *replacement - hint: { _id: 1 } - result: *result - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - update: *replacement - hint: { _id: 1 } - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/findOneAndUpdate-hint-clientError.json b/src/test/spec/json/crud/v2/findOneAndUpdate-hint-clientError.json deleted file mode 100644 index 8cd5cddb5..000000000 --- a/src/test/spec/json/crud/v2/findOneAndUpdate-hint-clientError.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "runOn": [ - { - "maxServerVersion": "4.0.99" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "findOneAndUpdate_hint", - "tests": [ - { - "description": "FindOneAndUpdate with hint string unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "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": "FindOneAndUpdate with hint document unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/findOneAndUpdate-hint-clientError.yml b/src/test/spec/json/crud/v2/findOneAndUpdate-hint-clientError.yml deleted file mode 100644 index aec3e244d..000000000 --- a/src/test/spec/json/crud/v2/findOneAndUpdate-hint-clientError.yml +++ /dev/null @@ -1,40 +0,0 @@ -runOn: - - { maxServerVersion: "4.0.99" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndUpdate_hint' - -tests: - - - description: "FindOneAndUpdate with hint string unsupported (client-side error)" - operations: - - - object: collection - name: findOneAndUpdate - arguments: - filter: &filter { _id: 1 } - update: &update { $inc: { x: 1 }} - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "FindOneAndUpdate with hint document unsupported (client-side error)" - operations: - - - object: collection - name: findOneAndUpdate - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/findOneAndUpdate-hint-serverError.json b/src/test/spec/json/crud/v2/findOneAndUpdate-hint-serverError.json deleted file mode 100644 index 1f4b2bda8..000000000 --- a/src/test/spec/json/crud/v2/findOneAndUpdate-hint-serverError.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.3.0" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "findOneAndUpdate_hint", - "tests": [ - { - "description": "FindOneAndUpdate with hint string unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndUpdate_hint", - "query": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "FindOneAndUpdate with hint document unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndUpdate_hint", - "query": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/findOneAndUpdate-hint-serverError.yml b/src/test/spec/json/crud/v2/findOneAndUpdate-hint-serverError.yml deleted file mode 100644 index 06f788a62..000000000 --- a/src/test/spec/json/crud/v2/findOneAndUpdate-hint-serverError.yml +++ /dev/null @@ -1,58 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Support for findAndModify - # hint was added in 4.3.1 (SERVER-42099), so we'll allow up to 4.3.0 - # (inclusive). - - { minServerVersion: "4.2.0", maxServerVersion: "4.3.0" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndUpdate_hint' - -tests: - - - description: "FindOneAndUpdate with hint string unsupported (server-side error)" - operations: - - - object: collection - name: findOneAndUpdate - arguments: - filter: &filter { _id: 1 } - update: &update { $inc: { x: 1 }} - hint: "_id_" - error: true - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - update: *update - hint: "_id_" - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "FindOneAndUpdate with hint document unsupported (server-side error)" - operations: - - - object: collection - name: findOneAndUpdate - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - error: true - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - update: *update - hint: { _id: 1 } - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/findOneAndUpdate-hint.json b/src/test/spec/json/crud/v2/findOneAndUpdate-hint.json deleted file mode 100644 index 451eecc01..000000000 --- a/src/test/spec/json/crud/v2/findOneAndUpdate-hint.json +++ /dev/null @@ -1,136 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.3.1" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "findOneAndUpdate_hint", - "tests": [ - { - "description": "FindOneAndUpdate with hint string", - "operations": [ - { - "object": "collection", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "result": { - "_id": 1, - "x": 11 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndUpdate_hint", - "query": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "FindOneAndUpdate with hint document", - "operations": [ - { - "object": "collection", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "result": { - "_id": 1, - "x": 11 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndUpdate_hint", - "query": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/findOneAndUpdate-hint.yml b/src/test/spec/json/crud/v2/findOneAndUpdate-hint.yml deleted file mode 100644 index 36b169c2a..000000000 --- a/src/test/spec/json/crud/v2/findOneAndUpdate-hint.yml +++ /dev/null @@ -1,55 +0,0 @@ -runOn: - - { minServerVersion: "4.3.1" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndUpdate_hint' - -tests: - - - description: "FindOneAndUpdate with hint string" - operations: - - - object: collection - name: findOneAndUpdate - arguments: - filter: &filter { _id: 1 } - update: &update { $inc: { x: 1 }} - hint: "_id_" - # original document is returned by default - result: &result { _id: 1, x: 11 } - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - update: *update - hint: "_id_" - outcome: &outcome - collection: - data: - - { _id: 1, x: 12 } - - { _id: 2, x: 22 } - - - description: "FindOneAndUpdate with hint document" - operations: - - - object: collection - name: findOneAndUpdate - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - result: *result - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - update: *update - hint: { _id: 1 } - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/replaceOne-hint.json b/src/test/spec/json/crud/v2/replaceOne-hint.json deleted file mode 100644 index de4aa4d02..000000000 --- a/src/test/spec/json/crud/v2/replaceOne-hint.json +++ /dev/null @@ -1,146 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.2.0" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "test_replaceone_hint", - "tests": [ - { - "description": "ReplaceOne with hint string", - "operations": [ - { - "object": "collection", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": "_id_" - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_replaceone_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "x": 111 - }, - "hint": "_id_" - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 111 - } - ] - } - } - }, - { - "description": "ReplaceOne with hint document", - "operations": [ - { - "object": "collection", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": { - "_id": 1 - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_replaceone_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "x": 111 - }, - "hint": { - "_id": 1 - } - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 111 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/replaceOne-hint.yml b/src/test/spec/json/crud/v2/replaceOne-hint.yml deleted file mode 100644 index 8b418d120..000000000 --- a/src/test/spec/json/crud/v2/replaceOne-hint.yml +++ /dev/null @@ -1,61 +0,0 @@ -runOn: - - { minServerVersion: "4.2.0" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - -collection_name: &collection_name 'test_replaceone_hint' - -tests: - - - description: "ReplaceOne with hint string" - operations: - - - object: collection - name: replaceOne - arguments: - filter: &filter { _id: { $gt: 1 } } - replacement: &replacement {x: 111} - hint: "_id_" - result: &result - matchedCount: 1 - modifiedCount: 1 - upsertedCount: 0 - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *replacement - hint: "_id_" - outcome: &outcome - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 111 } - - - description: "ReplaceOne with hint document" - operations: - - - object: collection - name: replaceOne - arguments: - filter: *filter - replacement: *replacement - hint: { _id: 1 } - result: *result - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *replacement - hint: { _id: 1 } - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/replaceOne-validation.json b/src/test/spec/json/crud/v2/replaceOne-validation.json deleted file mode 100644 index 2de4a6728..000000000 --- a/src/test/spec/json/crud/v2/replaceOne-validation.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "data": [ - { - "_id": 1, - "x": 11 - } - ], - "tests": [ - { - "description": "ReplaceOne prohibits atomic modifiers", - "operations": [ - { - "object": "collection", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "$set": { - "x": 22 - } - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/replaceOne-validation.yml b/src/test/spec/json/crud/v2/replaceOne-validation.yml deleted file mode 100644 index 60ac9894c..000000000 --- a/src/test/spec/json/crud/v2/replaceOne-validation.yml +++ /dev/null @@ -1,21 +0,0 @@ -data: - - { _id: 1, x: 11 } - -tests: - - - description: "ReplaceOne prohibits atomic modifiers" - operations: - - - object: collection - name: replaceOne - arguments: - filter: { _id: 1 } - # Only the first field is tested, as the spec permits drivers to only - # check that and rely on the server to check subsequent fields. - replacement: { $set: { x: 22 }} - error: true - expectations: [] - outcome: - collection: - data: - - { _id: 1, x: 11 } diff --git a/src/test/spec/json/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.json b/src/test/spec/json/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.json deleted file mode 100644 index 46839db70..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.json +++ /dev/null @@ -1,155 +0,0 @@ -{ - "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", - "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", - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.yml b/src/test/spec/json/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.yml deleted file mode 100644 index 7130aa1cf..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.yml +++ /dev/null @@ -1,60 +0,0 @@ -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - - {_id: 4, x: 44} - -collection_name: &collection_name 'BulkWrite_delete_hint' - -tests: - - - description: "Unacknowledged bulkWrite deleteOne with hints fails with client-side error" - operations: - - - name: "bulkWrite" - collectionOptions: &collection_options - writeConcern: { w: 0 } - arguments: - requests: - - - name: "deleteOne" - arguments: - filter: &deleteOne_filter1 { _id: 1 } - hint: &hint_string "_id_" - - - name: "deleteOne" - arguments: - filter: &deleteOne_filter2 { _id: 2 } - hint: &hint_doc { _id: 1 } - options: { ordered: true } - error: true - expectations: [] - outcome: &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" - operations: - - - name: "bulkWrite" - collectionOptions: *collection_options - arguments: - requests: - - - name: "deleteMany" - arguments: - filter: &deleteMany_filter1 { _id: { $lt: 3 } } - hint: *hint_string - - - name: "deleteMany" - arguments: - filter: &deleteMany_filter2 { _id: { $gte: 4 } } - hint: *hint_doc - options: { ordered: true } - error: true - expectations: [] - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.json b/src/test/spec/json/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.json deleted file mode 100644 index 4a41d76b3..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.json +++ /dev/null @@ -1,245 +0,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 hints fails with client-side error", - "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", - "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 fails with 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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.yml b/src/test/spec/json/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.yml deleted file mode 100644 index 2aecaa309..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.yml +++ /dev/null @@ -1,88 +0,0 @@ -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - - {_id: 4, x: 44} - -collection_name: &collection_name 'Bulkwrite_update_hint' - -tests: - - - description: "Unacknowledged bulkWrite updateOne with hints fails with client-side error" - operations: - - - name: "bulkWrite" - collectionOptions: &collection_options - writeConcern: { w: 0 } - arguments: - requests: - - - name: "updateOne" - arguments: - filter: &updateOne_filter { _id: 1 } - update: &updateOne_update { $inc: { x: 1 } } - hint: &hint_string "_id_" - - - name: "updateOne" - arguments: - filter: *updateOne_filter - update: *updateOne_update - hint: &hint_doc { _id: 1 } - options: { ordered: true } - error: true - expectations: [] - outcome: &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" - operations: - - - name: "bulkWrite" - collectionOptions: *collection_options - arguments: - requests: - - - name: "updateMany" - arguments: - filter: &updateMany_filter { _id: { $lt: 3 } } - update: &updateMany_update { $inc: { x: 1 } } - hint: *hint_string - - - name: "updateMany" - arguments: - filter: *updateMany_filter - update: *updateMany_update - hint: *hint_doc - options: { ordered: true } - error: true - expectations: [] - outcome: *outcome - - - description: "Unacknowledged bulkWrite replaceOne with hints fails with client-side error" - operations: - - - name: "bulkWrite" - collectionOptions: *collection_options - arguments: - requests: - - - name: "replaceOne" - arguments: - filter: { _id: 3 } - replacement: { x: 333 } - hint: *hint_string - - - name: "replaceOne" - arguments: - filter: { _id: 4 } - replacement: { x: 444 } - hint: *hint_doc - options: { ordered: true } - error: true - expectations: [] - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/unacknowledged-deleteMany-hint-clientError.json b/src/test/spec/json/crud/v2/unacknowledged-deleteMany-hint-clientError.json deleted file mode 100644 index 532f4282a..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-deleteMany-hint-clientError.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "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", - "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", - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/unacknowledged-deleteMany-hint-clientError.yml b/src/test/spec/json/crud/v2/unacknowledged-deleteMany-hint-clientError.yml deleted file mode 100644 index 4f08b361d..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-deleteMany-hint-clientError.yml +++ /dev/null @@ -1,40 +0,0 @@ -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - -collection_name: &collection_name 'DeleteMany_hint' - -tests: - - - description: "Unacknowledged deleteMany with hint string fails with client-side error" - operations: - - - object: collection - collectionOptions: &collection_options - writeConcern: { w: 0 } - name: deleteMany - arguments: - filter: &filter { _id: { $gt: 1 } } - hint: "_id_" - error: true - expectations: [] - outcome: &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" - operations: - - - object: collection - collectionOptions: *collection_options - name: deleteMany - arguments: - filter: *filter - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/unacknowledged-deleteOne-hint-clientError.json b/src/test/spec/json/crud/v2/unacknowledged-deleteOne-hint-clientError.json deleted file mode 100644 index ff3f05ea3..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-deleteOne-hint-clientError.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "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", - "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", - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/unacknowledged-deleteOne-hint-clientError.yml b/src/test/spec/json/crud/v2/unacknowledged-deleteOne-hint-clientError.yml deleted file mode 100644 index 1084235dd..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-deleteOne-hint-clientError.yml +++ /dev/null @@ -1,38 +0,0 @@ -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'DeleteOne_hint' - -tests: - - - description: "Unacknowledged deleteOne with hint string fails with client-side error" - operations: - - - object: collection - collectionOptions: &collection_options - writeConcern: { w: 0 } - name: deleteOne - arguments: - filter: &filter { _id: 1 } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "Unacknowledged deleteOne with hint document fails with client-side error" - operations: - - - object: collection - collectionOptions: *collection_options - name: deleteOne - arguments: - filter: *filter - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.json b/src/test/spec/json/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.json deleted file mode 100644 index 076978874..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "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", - "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", - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.yml b/src/test/spec/json/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.yml deleted file mode 100644 index fda6d85e1..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.yml +++ /dev/null @@ -1,42 +0,0 @@ -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndDelete_hint' - -tests: - - - description: "Unacknowledged findOneAndDelete with hint string fails with client-side error" - operations: - - - object: collection - collectionOptions: &collection_options - writeConcern: { w: 0 } - name: findOneAndDelete - arguments: - filter: &filter { _id: 1 } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "Unacknowledged findOneAndDelete with hint document fails with client-side error" - operations: - - - object: collection - collectionOptions: *collection_options - name: findOneAndDelete - arguments: - filter: &filter { _id: 1 } - hint: { _id: 1 } - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } diff --git a/src/test/spec/json/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.json b/src/test/spec/json/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.json deleted file mode 100644 index 38fbc817b..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "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", - "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", - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.yml b/src/test/spec/json/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.yml deleted file mode 100644 index 628aef536..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.yml +++ /dev/null @@ -1,40 +0,0 @@ -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'FindOneAndReplace_hint' - -tests: - - - description: "Unacknowledged findOneAndReplace with hint string fails with client-side error" - operations: - - - object: collection - collectionOptions: &collection_options - writeConcern: { w: 0 } - name: findOneAndReplace - arguments: - filter: &filter { _id: 1 } - replacement: &replacement { x: 33 } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "Unacknowledged findOneAndReplace with hint document fails with client-side error" - operations: - - - object: collection - collectionOptions: *collection_options - name: findOneAndReplace - arguments: - filter: *filter - replacement: *replacement - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.json b/src/test/spec/json/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.json deleted file mode 100644 index 615b4c0e6..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "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", - "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", - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.yml b/src/test/spec/json/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.yml deleted file mode 100644 index 3aa2ac044..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.yml +++ /dev/null @@ -1,40 +0,0 @@ -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'FindOneAndUpdate_hint' - -tests: - - - description: "Unacknowledged findOneAndUpdate with hint string fails with client-side error" - operations: - - - object: collection - collectionOptions: &collection_options - writeConcern: { w: 0 } - name: findOneAndUpdate - arguments: - filter: &filter { _id: 1 } - update: &update { $inc: { x: 1 }} - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "Unacknowledged findOneAndUpdate with hint document fails with client-side error" - operations: - - - object: collection - collectionOptions: *collection_options - name: findOneAndUpdate - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/unacknowledged-replaceOne-hint-clientError.json b/src/test/spec/json/crud/v2/unacknowledged-replaceOne-hint-clientError.json deleted file mode 100644 index c4add73c2..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-replaceOne-hint-clientError.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "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", - "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", - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/unacknowledged-replaceOne-hint-clientError.yml b/src/test/spec/json/crud/v2/unacknowledged-replaceOne-hint-clientError.yml deleted file mode 100644 index 5d5cbeac1..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-replaceOne-hint-clientError.yml +++ /dev/null @@ -1,40 +0,0 @@ -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - -collection_name: &collection_name 'ReplaceOne_hint' - -tests: - - - description: "Unacknowledged ReplaceOne with hint string fails with client-side error" - operations: - - - object: collection - collectionOptions: &collection_options - writeConcern: { w: 0 } - name: replaceOne - arguments: - filter: &filter { _id: { $gt: 1 } } - replacement: &replacement { x: 111 } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - - description: "Unacknowledged ReplaceOne with hint document fails with client-side error" - operations: - - - object: collection - collectionOptions: *collection_options - name: replaceOne - arguments: - filter: *filter - replacement: *replacement - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/unacknowledged-updateMany-hint-clientError.json b/src/test/spec/json/crud/v2/unacknowledged-updateMany-hint-clientError.json deleted file mode 100644 index eaf3efd1c..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-updateMany-hint-clientError.json +++ /dev/null @@ -1,115 +0,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 fails with client-side error", - "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", - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/unacknowledged-updateMany-hint-clientError.yml b/src/test/spec/json/crud/v2/unacknowledged-updateMany-hint-clientError.yml deleted file mode 100644 index aeec51b92..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-updateMany-hint-clientError.yml +++ /dev/null @@ -1,43 +0,0 @@ -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - -collection_name: &collection_name 'Updatemany_hint' - -tests: - - - description: "Unacknowledged updateMany with hint string fails with client-side error" - operations: - - - object: collection - collectionOptions: &collection_options - writeConcern: { w: 0 } - name: updateMany - arguments: - filter: &filter { _id: { $gt: 1 } } - update: &update { $inc: { x: 1 } } - hint: "_id_" - error: true - expectations: [] - outcome: &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" - operations: - - - object: collection - collectionOptions: *collection_options - name: updateMany - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome - diff --git a/src/test/spec/json/crud/v2/unacknowledged-updateOne-hint-clientError.json b/src/test/spec/json/crud/v2/unacknowledged-updateOne-hint-clientError.json deleted file mode 100644 index 1f8f73801..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-updateOne-hint-clientError.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "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", - "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", - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/unacknowledged-updateOne-hint-clientError.yml b/src/test/spec/json/crud/v2/unacknowledged-updateOne-hint-clientError.yml deleted file mode 100644 index bdd32aea3..000000000 --- a/src/test/spec/json/crud/v2/unacknowledged-updateOne-hint-clientError.yml +++ /dev/null @@ -1,40 +0,0 @@ -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - -collection_name: &collection_name 'UpdateOne_hint' - -tests: - - - description: "Unacknowledged updateOne with hint string fails with client-side error" - operations: - - - object: collection - collectionOptions: &collection_options - writeConcern: { w: 0 } - name: updateOne - arguments: - filter: &filter { _id: { $gt: 1 } } - update: &update { $inc: { x: 1 } } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - - description: "Unacknowledged updateOne with hint document fails with client-side error" - operations: - - - object: collection - collectionOptions: *collection_options - name: updateOne - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/updateMany-hint-clientError.json b/src/test/spec/json/crud/v2/updateMany-hint-clientError.json deleted file mode 100644 index 44ebddc53..000000000 --- a/src/test/spec/json/crud/v2/updateMany-hint-clientError.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "runOn": [ - { - "maxServerVersion": "3.3.99" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "collection_name": "test_updatemany_hint", - "tests": [ - { - "description": "UpdateMany with hint string unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "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": "UpdateMany with hint document unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/updateMany-hint-clientError.yml b/src/test/spec/json/crud/v2/updateMany-hint-clientError.yml deleted file mode 100644 index c6a06ef5b..000000000 --- a/src/test/spec/json/crud/v2/updateMany-hint-clientError.yml +++ /dev/null @@ -1,45 +0,0 @@ -runOn: - # Server versions >= 3.4.0 will return an error response for unrecognized - # updateMany options. These tests check that the driver will raise an error - # if a hint is provided on a server version < 3.4. - - { maxServerVersion: "3.3.99" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - -collection_name: &collection_name 'test_updatemany_hint' - -tests: - - - description: "UpdateMany with hint string unsupported (client-side error)" - operations: - - - object: collection - name: updateMany - arguments: - filter: &filter { _id: { $gt: 1 } } - update: &update { $inc: { x: 1 } } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - - - description: "UpdateMany with hint document unsupported (client-side error)" - operations: - - - object: collection - name: updateMany - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/updateMany-hint-serverError.json b/src/test/spec/json/crud/v2/updateMany-hint-serverError.json deleted file mode 100644 index 86f21246e..000000000 --- a/src/test/spec/json/crud/v2/updateMany-hint-serverError.json +++ /dev/null @@ -1,161 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.1.9" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "collection_name": "test_updatemany_hint", - "tests": [ - { - "description": "UpdateMany with hint string unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_updatemany_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "hint": "_id_" - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "UpdateMany with hint document unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_updatemany_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "hint": { - "_id": 1 - } - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/updateMany-hint-serverError.yml b/src/test/spec/json/crud/v2/updateMany-hint-serverError.yml deleted file mode 100644 index 245dbc725..000000000 --- a/src/test/spec/json/crud/v2/updateMany-hint-serverError.yml +++ /dev/null @@ -1,66 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Server versions >= 3.4.0 - # raise errors for unknown updateMany options, and server versions >= 4.2.0 - # support the hint option in updateMany. - - { minServerVersion: "3.4.0", maxServerVersion: "4.1.9" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - -collection_name: &collection_name 'test_updatemany_hint' - -tests: - - - description: "UpdateMany with hint string unsupported (server-side error)" - operations: - - - object: collection - name: updateMany - arguments: - filter: &filter { _id: { $gt: 1 } } - update: &update { $inc: { x: 1 } } - hint: "_id_" - error: true - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *update - multi: true - hint: "_id_" - outcome: &outcome - collection: - data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - - - description: "UpdateMany with hint document unsupported (server-side error)" - operations: - - - object: collection - name: updateMany - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - error: true - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *update - multi: true - hint: { _id: 1 } - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/updateMany-hint.json b/src/test/spec/json/crud/v2/updateMany-hint.json deleted file mode 100644 index 489348917..000000000 --- a/src/test/spec/json/crud/v2/updateMany-hint.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.2.0" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "collection_name": "test_updatemany_hint", - "tests": [ - { - "description": "UpdateMany with hint string", - "operations": [ - { - "object": "collection", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "result": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_updatemany_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "hint": "_id_" - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 23 - }, - { - "_id": 3, - "x": 34 - } - ] - } - } - }, - { - "description": "UpdateMany with hint document", - "operations": [ - { - "object": "collection", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "result": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_updatemany_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "hint": { - "_id": 1 - } - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 23 - }, - { - "_id": 3, - "x": 34 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/updateMany-hint.yml b/src/test/spec/json/crud/v2/updateMany-hint.yml deleted file mode 100644 index 57067f077..000000000 --- a/src/test/spec/json/crud/v2/updateMany-hint.yml +++ /dev/null @@ -1,65 +0,0 @@ -runOn: - - { minServerVersion: "4.2.0" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - -collection_name: &collection_name 'test_updatemany_hint' - -tests: - - - description: "UpdateMany with hint string" - operations: - - - object: collection - name: updateMany - arguments: - filter: &filter { _id: { $gt: 1 } } - update: &update { $inc: { x: 1 } } - hint: "_id_" - result: &result - matchedCount: 2 - modifiedCount: 2 - upsertedCount: 0 - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *update - multi: true - hint: "_id_" - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 23 } - - { _id: 3, x: 34 } - - - description: "UpdateMany with hint document" - operations: - - - object: collection - name: updateMany - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - result: *result - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *update - multi: true - hint: { _id: 1 } - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/updateMany-validation.json b/src/test/spec/json/crud/v2/updateMany-validation.json deleted file mode 100644 index a85ccfa86..000000000 --- a/src/test/spec/json/crud/v2/updateMany-validation.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "tests": [ - { - "description": "UpdateOne requires atomic modifiers", - "operations": [ - { - "object": "collection", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "x": 44 - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/updateMany-validation.yml b/src/test/spec/json/crud/v2/updateMany-validation.yml deleted file mode 100644 index 982df8262..000000000 --- a/src/test/spec/json/crud/v2/updateMany-validation.yml +++ /dev/null @@ -1,25 +0,0 @@ -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - -tests: - - - description: "UpdateOne requires atomic modifiers" - operations: - - - object: collection - name: updateMany - arguments: - filter: { _id: { $gt: 1 }} - # Only the first field is tested, as the spec permits drivers to only - # check that and rely on the server to check subsequent fields. - update: { x: 44 } - error: true - expectations: [] - outcome: - collection: - data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} diff --git a/src/test/spec/json/crud/v2/updateOne-hint-clientError.json b/src/test/spec/json/crud/v2/updateOne-hint-clientError.json deleted file mode 100644 index 82bfe368c..000000000 --- a/src/test/spec/json/crud/v2/updateOne-hint-clientError.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "runOn": [ - { - "maxServerVersion": "3.3.99" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "test_updateone_hint", - "tests": [ - { - "description": "UpdateOne with hint string unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "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": "UpdateOne with hint document unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "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 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/updateOne-hint-clientError.yml b/src/test/spec/json/crud/v2/updateOne-hint-clientError.yml deleted file mode 100644 index 41e42ebf2..000000000 --- a/src/test/spec/json/crud/v2/updateOne-hint-clientError.yml +++ /dev/null @@ -1,43 +0,0 @@ -runOn: - # Server versions >= 3.4.0 will return an error response for unrecognized - # updateOne options. These tests check that the driver will raise an error - # if a hint is provided on a server version < 3.4. - - { maxServerVersion: "3.3.99" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - -collection_name: &collection_name 'test_updateone_hint' - -tests: - - - description: "UpdateOne with hint string unsupported (client-side error)" - operations: - - - object: collection - name: updateOne - arguments: - filter: &filter { _id: { $gt: 1 } } - update: &update { $inc: { x: 1 } } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - - description: "UpdateOne with hint document unsupported (client-side error)" - operations: - - - object: collection - name: updateOne - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/updateOne-hint-serverError.json b/src/test/spec/json/crud/v2/updateOne-hint-serverError.json deleted file mode 100644 index 8e8037eb8..000000000 --- a/src/test/spec/json/crud/v2/updateOne-hint-serverError.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.1.9" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "test_updateone_hint", - "tests": [ - { - "description": "UpdateOne with hint string unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_updateone_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "UpdateOne with hint document unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_updateone_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/updateOne-hint-serverError.yml b/src/test/spec/json/crud/v2/updateOne-hint-serverError.yml deleted file mode 100644 index 73b115197..000000000 --- a/src/test/spec/json/crud/v2/updateOne-hint-serverError.yml +++ /dev/null @@ -1,62 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Server versions >= 3.4.0 - # raise errors for unknown updateOne options, and server versions >= 4.2.0 - # support the hint option in updateOne. - - { minServerVersion: "3.4.0", maxServerVersion: "4.1.9" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - -collection_name: &collection_name 'test_updateone_hint' - -tests: - - - description: "UpdateOne with hint string unsupported (server-side error)" - operations: - - - object: collection - name: updateOne - arguments: - filter: &filter { _id: { $gt: 1 } } - update: &update { $inc: { x: 1 } } - hint: "_id_" - error: true - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *update - hint: "_id_" - outcome: &outcome - collection: - data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - - description: "UpdateOne with hint document unsupported (server-side error)" - operations: - - - object: collection - name: updateOne - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - error: true - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *update - hint: { _id: 1 } - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/updateOne-hint.json b/src/test/spec/json/crud/v2/updateOne-hint.json deleted file mode 100644 index 43f76da49..000000000 --- a/src/test/spec/json/crud/v2/updateOne-hint.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.2.0" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "test_updateone_hint", - "tests": [ - { - "description": "UpdateOne with hint string", - "operations": [ - { - "object": "collection", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_updateone_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 23 - } - ] - } - } - }, - { - "description": "UpdateOne with hint document", - "operations": [ - { - "object": "collection", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_updateone_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 23 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/updateOne-hint.yml b/src/test/spec/json/crud/v2/updateOne-hint.yml deleted file mode 100644 index cb86da947..000000000 --- a/src/test/spec/json/crud/v2/updateOne-hint.yml +++ /dev/null @@ -1,61 +0,0 @@ -runOn: - - { minServerVersion: "4.2.0" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - -collection_name: &collection_name 'test_updateone_hint' - -tests: - - - description: "UpdateOne with hint string" - operations: - - - object: collection - name: updateOne - arguments: - filter: &filter { _id: { $gt: 1 } } - update: &update { $inc: { x: 1 } } - hint: "_id_" - result: &result - matchedCount: 1 - modifiedCount: 1 - upsertedCount: 0 - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *update - hint: "_id_" - outcome: &outcome - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 23 } - - - description: "UpdateOne with hint document" - operations: - - - object: collection - name: updateOne - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - result: *result - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *update - hint: { _id: 1 } - outcome: *outcome diff --git a/src/test/spec/json/crud/v2/updateOne-validation.json b/src/test/spec/json/crud/v2/updateOne-validation.json deleted file mode 100644 index 6c919f5ea..000000000 --- a/src/test/spec/json/crud/v2/updateOne-validation.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "data": [ - { - "_id": 1, - "x": 11 - } - ], - "tests": [ - { - "description": "UpdateOne requires atomic modifiers", - "operations": [ - { - "object": "collection", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "x": 22 - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/updateOne-validation.yml b/src/test/spec/json/crud/v2/updateOne-validation.yml deleted file mode 100644 index 290952ca5..000000000 --- a/src/test/spec/json/crud/v2/updateOne-validation.yml +++ /dev/null @@ -1,21 +0,0 @@ -data: - - { _id: 1, x: 11 } - -tests: - - - description: "UpdateOne requires atomic modifiers" - operations: - - - object: collection - name: updateOne - arguments: - filter: { _id: 1 } - # Only the first field is tested, as the spec permits drivers to only - # check that and rely on the server to check subsequent fields. - update: { x: 22 } - error: true - expectations: [] - outcome: - collection: - data: - - { _id: 1, x: 11 } diff --git a/src/test/spec/json/crud/v2/updateWithPipelines.json b/src/test/spec/json/crud/v2/updateWithPipelines.json deleted file mode 100644 index a310f2825..000000000 --- a/src/test/spec/json/crud/v2/updateWithPipelines.json +++ /dev/null @@ -1,408 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.11" - } - ], - "data": [ - { - "_id": 1, - "x": 1, - "y": 1, - "t": { - "u": { - "v": 1 - } - } - }, - { - "_id": 2, - "x": 2, - "y": 1 - } - ], - "collection_name": "test", - "database_name": "crud-tests", - "tests": [ - { - "description": "UpdateOne using pipelines", - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$replaceRoot": { - "newRoot": "$t" - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$replaceRoot": { - "newRoot": "$t" - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - } - ] - }, - "command_name": "update", - "database_name": "crud-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "u": { - "v": 1 - }, - "foo": 1 - }, - { - "_id": 2, - "x": 2, - "y": 1 - } - ] - } - } - }, - { - "description": "UpdateMany using pipelines", - "operations": [ - { - "name": "updateMany", - "arguments": { - "filter": {}, - "update": [ - { - "$project": { - "x": 1 - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - }, - "result": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": {}, - "u": [ - { - "$project": { - "x": 1 - } - }, - { - "$addFields": { - "foo": 1 - } - } - ], - "multi": true - } - ] - }, - "command_name": "update", - "database_name": "crud-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 1, - "foo": 1 - }, - { - "_id": 2, - "x": 2, - "foo": 1 - } - ] - } - } - }, - { - "description": "FindOneAndUpdate using pipelines", - "operations": [ - { - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$project": { - "x": 1 - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "test", - "update": [ - { - "$project": { - "x": 1 - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - }, - "command_name": "findAndModify", - "database_name": "crud-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 1, - "foo": 1 - }, - { - "_id": 2, - "x": 2, - "y": 1 - } - ] - } - } - }, - { - "description": "UpdateOne in bulk write using pipelines", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$replaceRoot": { - "newRoot": "$t" - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - } - } - ] - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$replaceRoot": { - "newRoot": "$t" - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - } - ] - }, - "command_name": "update", - "database_name": "crud-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "u": { - "v": 1 - }, - "foo": 1 - }, - { - "_id": 2, - "x": 2, - "y": 1 - } - ] - } - } - }, - { - "description": "UpdateMany in bulk write using pipelines", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "updateMany", - "arguments": { - "filter": {}, - "update": [ - { - "$project": { - "x": 1 - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - } - } - ] - }, - "result": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": {}, - "u": [ - { - "$project": { - "x": 1 - } - }, - { - "$addFields": { - "foo": 1 - } - } - ], - "multi": true - } - ] - }, - "command_name": "update", - "database_name": "crud-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 1, - "foo": 1 - }, - { - "_id": 2, - "x": 2, - "foo": 1 - } - ] - } - } - } - ] -} diff --git a/src/test/spec/json/crud/v2/updateWithPipelines.yml b/src/test/spec/json/crud/v2/updateWithPipelines.yml deleted file mode 100644 index 08eef7b0b..000000000 --- a/src/test/spec/json/crud/v2/updateWithPipelines.yml +++ /dev/null @@ -1,157 +0,0 @@ -runOn: - - - minServerVersion: "4.1.11" - -data: - - { _id: 1, x: 1, y: 1, t: {u: {v: 1}} } - - { _id: 2, x: 2, y: 1 } - -collection_name: &collection_name "test" -database_name: &database_name "crud-tests" - -tests: - - - description: "UpdateOne using pipelines" - operations: - - - name: "updateOne" - arguments: - filter: { _id: 1 } - update: [ { $replaceRoot: { newRoot: "$t" } }, { $addFields: { foo: 1 } } ] - result: - matchedCount: 1 - modifiedCount: 1 - upsertedCount: 0 - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: { _id: 1 } - u: [ { $replaceRoot: { newRoot: "$t" } }, { $addFields: { foo: 1 } } ] - command_name: update - database_name: *database_name - outcome: - collection: - data: - - { _id: 1, u: {v: 1}, foo: 1 } - - { _id: 2, x: 2, y: 1 } - - - description: "UpdateMany using pipelines" - operations: - - - name: "updateMany" - arguments: - filter: {} - update: [ { $project: { x: 1 } }, { $addFields: { foo: 1 } } ] - result: - matchedCount: 2 - modifiedCount: 2 - upsertedCount: 0 - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: { } - u: [ { $project: { x: 1 } }, { $addFields: { foo: 1 } } ] - multi: true - command_name: update - database_name: *database_name - outcome: - collection: - data: - - { _id: 1, x: 1, foo: 1 } - - { _id: 2, x: 2, foo: 1 } - - - description: "FindOneAndUpdate using pipelines" - operations: - - - name: "findOneAndUpdate" - arguments: - filter: { _id: 1 } - update: [ { $project: { x: 1 } }, { $addFields: { foo: 1 } } ] - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - update: - - $project: { x: 1 } - - $addFields: { foo: 1 } - command_name: findAndModify - database_name: *database_name - outcome: - collection: - data: - - { _id: 1, x: 1, foo: 1 } - - { _id: 2, x: 2, y: 1 } - - - description: "UpdateOne in bulk write using pipelines" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "updateOne" - arguments: - filter: { _id: 1 } - update: [ { $replaceRoot: { newRoot: "$t" } }, { $addFields: { foo: 1 } } ] - result: - matchedCount: 1 - modifiedCount: 1 - upsertedCount: 0 - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: { _id: 1 } - u: [ { $replaceRoot: { newRoot: "$t" } }, { $addFields: { foo: 1 } } ] - command_name: update - database_name: *database_name - outcome: - collection: - data: - - { _id: 1, u: {v: 1}, foo: 1 } - - { _id: 2, x: 2, y: 1 } - - - description: "UpdateMany in bulk write using pipelines" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "updateMany" - arguments: - filter: {} - update: [ { $project: { x: 1 } }, { $addFields: { foo: 1 } } ] - result: - matchedCount: 2 - modifiedCount: 2 - upsertedCount: 0 - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: { } - u: [ { $project: { x: 1 } }, { $addFields: { foo: 1 } } ] - multi: true - command_name: update - database_name: *database_name - outcome: - collection: - data: - - { _id: 1, x: 1, foo: 1 } - - { _id: 2, x: 2, foo: 1 } diff --git a/src/test/spec/mod.rs b/src/test/spec/mod.rs index f04e4c8a1..c3151d8d1 100644 --- a/src/test/spec/mod.rs +++ b/src/test/spec/mod.rs @@ -3,9 +3,8 @@ mod auth; mod collection_management; mod command_monitoring; mod connection_stepdown; -mod crud_unified; +mod crud; mod crud_v1; -mod crud_v2; #[cfg(not(feature = "sync"))] mod initial_dns_seedlist_discovery; mod ocsp; diff --git a/src/test/spec/unified_runner/test_runner.rs b/src/test/spec/unified_runner/test_runner.rs index 5118300b8..47eaa682c 100644 --- a/src/test/spec/unified_runner/test_runner.rs +++ b/src/test/spec/unified_runner/test_runner.rs @@ -71,16 +71,18 @@ impl TestRunner { let mut options = ClientOptions::parse_uri(&client.uri, None).await.unwrap(); options.command_event_handler = Some(observer.clone()); options.server_api = server_api; - match client.use_multiple_mongoses { - Some(true) => { - if options.hosts.len() <= 1 { - panic!("Test requires multiple mongos hosts"); + if TestClient::new().await.is_sharded() { + match client.use_multiple_mongoses { + Some(true) => { + if options.hosts.len() <= 1 { + panic!("Test requires multiple mongos hosts"); + } } + Some(false) => { + options.hosts.drain(1..); + } + None => {} } - Some(false) => { - options.hosts.drain(1..); - } - None => {} } let client = Client::with_options(options).unwrap(); From 965bb67ab7dec609f1fd0b33262aab9e2dc46856 Mon Sep 17 00:00:00 2001 From: Isabel Atkinson Date: Fri, 30 Jul 2021 12:22:53 -0400 Subject: [PATCH 2/2] add new files --- src/test/spec/crud.rs | 12 + .../json/crud/unified/aggregate-merge.json | 497 ++++++++++++++++++ .../json/crud/unified/aggregate-merge.yml | 185 +++++++ .../unified/aggregate-out-readConcern.json | 407 ++++++++++++++ .../unified/aggregate-out-readConcern.yml | 171 ++++++ .../spec/json/crud/unified/aggregate.json | 166 ++++++ src/test/spec/json/crud/unified/aggregate.yml | 68 +++ .../bulkWrite-arrayFilters-clientError.json | 151 ++++++ .../bulkWrite-arrayFilters-clientError.yml | 98 ++++ .../crud/unified/bulkWrite-arrayFilters.json | 279 ++++++++++ .../crud/unified/bulkWrite-arrayFilters.yml | 174 ++++++ .../bulkWrite-delete-hint-clientError.json | 193 +++++++ .../bulkWrite-delete-hint-clientError.yml | 113 ++++ .../bulkWrite-delete-hint-serverError.json | 252 +++++++++ .../bulkWrite-delete-hint-serverError.yml | 142 +++++ .../crud/unified/bulkWrite-delete-hint.json | 247 +++++++++ .../crud/unified/bulkWrite-delete-hint.yml | 154 ++++++ .../bulkWrite-update-hint-clientError.json | 284 ++++++++++ .../bulkWrite-update-hint-clientError.yml | 148 ++++++ .../bulkWrite-update-hint-serverError.json | 422 +++++++++++++++ .../bulkWrite-update-hint-serverError.yml | 249 +++++++++ .../crud/unified/bulkWrite-update-hint.json | 445 ++++++++++++++++ .../crud/unified/bulkWrite-update-hint.yml | 256 +++++++++ .../spec/json/crud/unified/db-aggregate.json | 107 ++++ .../spec/json/crud/unified/db-aggregate.yml | 73 +++ .../unified/deleteMany-hint-clientError.json | 149 ++++++ .../unified/deleteMany-hint-clientError.yml | 87 +++ .../unified/deleteMany-hint-serverError.json | 190 +++++++ .../unified/deleteMany-hint-serverError.yml | 107 ++++ .../json/crud/unified/deleteMany-hint.json | 173 ++++++ .../json/crud/unified/deleteMany-hint.yml | 99 ++++ .../unified/deleteOne-hint-clientError.json | 133 +++++ .../unified/deleteOne-hint-clientError.yml | 80 +++ .../unified/deleteOne-hint-serverError.json | 170 ++++++ .../unified/deleteOne-hint-serverError.yml | 100 ++++ .../json/crud/unified/deleteOne-hint.json | 161 ++++++ .../spec/json/crud/unified/deleteOne-hint.yml | 95 ++++ .../find-allowdiskuse-clientError.json | 79 +++ .../unified/find-allowdiskuse-clientError.yml | 55 ++ .../find-allowdiskuse-serverError.json | 100 ++++ .../unified/find-allowdiskuse-serverError.yml | 68 +++ .../json/crud/unified/find-allowdiskuse.json | 120 +++++ .../json/crud/unified/find-allowdiskuse.yml | 79 +++ src/test/spec/json/crud/unified/find.json | 156 ++++++ src/test/spec/json/crud/unified/find.yml | 68 +++ .../findOneAndDelete-hint-clientError.json | 133 +++++ .../findOneAndDelete-hint-clientError.yml | 91 ++++ .../findOneAndDelete-hint-serverError.json | 162 ++++++ .../findOneAndDelete-hint-serverError.yml | 107 ++++ .../crud/unified/findOneAndDelete-hint.json | 155 ++++++ .../crud/unified/findOneAndDelete-hint.yml | 102 ++++ .../findOneAndReplace-hint-clientError.json | 139 +++++ .../findOneAndReplace-hint-clientError.yml | 83 +++ .../findOneAndReplace-hint-serverError.json | 172 ++++++ .../findOneAndReplace-hint-serverError.yml | 99 ++++ .../crud/unified/findOneAndReplace-hint.json | 173 ++++++ .../crud/unified/findOneAndReplace-hint.yml | 98 ++++ .../findOneAndUpdate-hint-clientError.json | 143 +++++ .../findOneAndUpdate-hint-clientError.yml | 84 +++ .../findOneAndUpdate-hint-serverError.json | 180 +++++++ .../findOneAndUpdate-hint-serverError.yml | 100 ++++ .../crud/unified/findOneAndUpdate-hint.json | 181 +++++++ .../crud/unified/findOneAndUpdate-hint.yml | 99 ++++ .../json/crud/unified/replaceOne-hint.json | 203 +++++++ .../json/crud/unified/replaceOne-hint.yml | 112 ++++ ...ged-bulkWrite-delete-hint-clientError.json | 193 +++++++ ...dged-bulkWrite-delete-hint-clientError.yml | 112 ++++ ...ged-bulkWrite-update-hint-clientError.json | 284 ++++++++++ ...dged-bulkWrite-update-hint-clientError.yml | 147 ++++++ ...nowledged-deleteMany-hint-clientError.json | 149 ++++++ ...knowledged-deleteMany-hint-clientError.yml | 86 +++ ...knowledged-deleteOne-hint-clientError.json | 133 +++++ ...cknowledged-deleteOne-hint-clientError.yml | 79 +++ ...ged-findOneAndDelete-hint-clientError.json | 133 +++++ ...dged-findOneAndDelete-hint-clientError.yml | 90 ++++ ...ed-findOneAndReplace-hint-clientError.json | 139 +++++ ...ged-findOneAndReplace-hint-clientError.yml | 82 +++ ...ged-findOneAndUpdate-hint-clientError.json | 143 +++++ ...dged-findOneAndUpdate-hint-clientError.yml | 83 +++ ...nowledged-replaceOne-hint-clientError.json | 143 +++++ ...knowledged-replaceOne-hint-clientError.yml | 83 +++ ...nowledged-updateMany-hint-clientError.json | 159 ++++++ ...knowledged-updateMany-hint-clientError.yml | 90 ++++ ...knowledged-updateOne-hint-clientError.json | 147 ++++++ ...cknowledged-updateOne-hint-clientError.yml | 84 +++ .../unified/updateMany-hint-clientError.json | 159 ++++++ .../unified/updateMany-hint-clientError.yml | 91 ++++ .../unified/updateMany-hint-serverError.json | 216 ++++++++ .../unified/updateMany-hint-serverError.yml | 117 +++++ .../json/crud/unified/updateMany-hint.json | 219 ++++++++ .../json/crud/unified/updateMany-hint.yml | 117 +++++ .../unified/updateOne-hint-clientError.json | 147 ++++++ .../unified/updateOne-hint-clientError.yml | 85 +++ .../unified/updateOne-hint-serverError.json | 208 ++++++++ .../unified/updateOne-hint-serverError.yml | 113 ++++ .../json/crud/unified/updateOne-hint.json | 211 ++++++++ .../spec/json/crud/unified/updateOne-hint.yml | 113 ++++ .../crud/unified/updateWithPipelines.json | 494 +++++++++++++++++ .../json/crud/unified/updateWithPipelines.yml | 305 +++++++++++ 99 files changed, 15332 insertions(+) create mode 100644 src/test/spec/crud.rs create mode 100644 src/test/spec/json/crud/unified/aggregate-merge.json create mode 100644 src/test/spec/json/crud/unified/aggregate-merge.yml create mode 100644 src/test/spec/json/crud/unified/aggregate-out-readConcern.json create mode 100644 src/test/spec/json/crud/unified/aggregate-out-readConcern.yml create mode 100644 src/test/spec/json/crud/unified/aggregate.json create mode 100644 src/test/spec/json/crud/unified/aggregate.yml create mode 100644 src/test/spec/json/crud/unified/bulkWrite-arrayFilters-clientError.json create mode 100644 src/test/spec/json/crud/unified/bulkWrite-arrayFilters-clientError.yml create mode 100644 src/test/spec/json/crud/unified/bulkWrite-arrayFilters.json create mode 100644 src/test/spec/json/crud/unified/bulkWrite-arrayFilters.yml create mode 100644 src/test/spec/json/crud/unified/bulkWrite-delete-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/bulkWrite-delete-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/bulkWrite-delete-hint-serverError.json create mode 100644 src/test/spec/json/crud/unified/bulkWrite-delete-hint-serverError.yml create mode 100644 src/test/spec/json/crud/unified/bulkWrite-delete-hint.json create mode 100644 src/test/spec/json/crud/unified/bulkWrite-delete-hint.yml create mode 100644 src/test/spec/json/crud/unified/bulkWrite-update-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/bulkWrite-update-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/bulkWrite-update-hint-serverError.json create mode 100644 src/test/spec/json/crud/unified/bulkWrite-update-hint-serverError.yml create mode 100644 src/test/spec/json/crud/unified/bulkWrite-update-hint.json create mode 100644 src/test/spec/json/crud/unified/bulkWrite-update-hint.yml create mode 100644 src/test/spec/json/crud/unified/db-aggregate.json create mode 100644 src/test/spec/json/crud/unified/db-aggregate.yml create mode 100644 src/test/spec/json/crud/unified/deleteMany-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/deleteMany-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/deleteMany-hint-serverError.json create mode 100644 src/test/spec/json/crud/unified/deleteMany-hint-serverError.yml create mode 100644 src/test/spec/json/crud/unified/deleteMany-hint.json create mode 100644 src/test/spec/json/crud/unified/deleteMany-hint.yml create mode 100644 src/test/spec/json/crud/unified/deleteOne-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/deleteOne-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/deleteOne-hint-serverError.json create mode 100644 src/test/spec/json/crud/unified/deleteOne-hint-serverError.yml create mode 100644 src/test/spec/json/crud/unified/deleteOne-hint.json create mode 100644 src/test/spec/json/crud/unified/deleteOne-hint.yml create mode 100644 src/test/spec/json/crud/unified/find-allowdiskuse-clientError.json create mode 100644 src/test/spec/json/crud/unified/find-allowdiskuse-clientError.yml create mode 100644 src/test/spec/json/crud/unified/find-allowdiskuse-serverError.json create mode 100644 src/test/spec/json/crud/unified/find-allowdiskuse-serverError.yml create mode 100644 src/test/spec/json/crud/unified/find-allowdiskuse.json create mode 100644 src/test/spec/json/crud/unified/find-allowdiskuse.yml create mode 100644 src/test/spec/json/crud/unified/find.json create mode 100644 src/test/spec/json/crud/unified/find.yml create mode 100644 src/test/spec/json/crud/unified/findOneAndDelete-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/findOneAndDelete-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/findOneAndDelete-hint-serverError.json create mode 100644 src/test/spec/json/crud/unified/findOneAndDelete-hint-serverError.yml create mode 100644 src/test/spec/json/crud/unified/findOneAndDelete-hint.json create mode 100644 src/test/spec/json/crud/unified/findOneAndDelete-hint.yml create mode 100644 src/test/spec/json/crud/unified/findOneAndReplace-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/findOneAndReplace-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/findOneAndReplace-hint-serverError.json create mode 100644 src/test/spec/json/crud/unified/findOneAndReplace-hint-serverError.yml create mode 100644 src/test/spec/json/crud/unified/findOneAndReplace-hint.json create mode 100644 src/test/spec/json/crud/unified/findOneAndReplace-hint.yml create mode 100644 src/test/spec/json/crud/unified/findOneAndUpdate-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/findOneAndUpdate-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/findOneAndUpdate-hint-serverError.json create mode 100644 src/test/spec/json/crud/unified/findOneAndUpdate-hint-serverError.yml create mode 100644 src/test/spec/json/crud/unified/findOneAndUpdate-hint.json create mode 100644 src/test/spec/json/crud/unified/findOneAndUpdate-hint.yml create mode 100644 src/test/spec/json/crud/unified/replaceOne-hint.json create mode 100644 src/test/spec/json/crud/unified/replaceOne-hint.yml create mode 100644 src/test/spec/json/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/unacknowledged-deleteMany-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/unacknowledged-deleteMany-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/unacknowledged-deleteOne-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/unacknowledged-deleteOne-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/unacknowledged-replaceOne-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/unacknowledged-replaceOne-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/unacknowledged-updateMany-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/unacknowledged-updateMany-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/unacknowledged-updateOne-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/unacknowledged-updateOne-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/updateMany-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/updateMany-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/updateMany-hint-serverError.json create mode 100644 src/test/spec/json/crud/unified/updateMany-hint-serverError.yml create mode 100644 src/test/spec/json/crud/unified/updateMany-hint.json create mode 100644 src/test/spec/json/crud/unified/updateMany-hint.yml create mode 100644 src/test/spec/json/crud/unified/updateOne-hint-clientError.json create mode 100644 src/test/spec/json/crud/unified/updateOne-hint-clientError.yml create mode 100644 src/test/spec/json/crud/unified/updateOne-hint-serverError.json create mode 100644 src/test/spec/json/crud/unified/updateOne-hint-serverError.yml create mode 100644 src/test/spec/json/crud/unified/updateOne-hint.json create mode 100644 src/test/spec/json/crud/unified/updateOne-hint.yml create mode 100644 src/test/spec/json/crud/unified/updateWithPipelines.json create mode 100644 src/test/spec/json/crud/unified/updateWithPipelines.yml diff --git a/src/test/spec/crud.rs b/src/test/spec/crud.rs new file mode 100644 index 000000000..b03130357 --- /dev/null +++ b/src/test/spec/crud.rs @@ -0,0 +1,12 @@ +use tokio::sync::RwLockWriteGuard; + +use crate::test::{run_spec_test, LOCK}; + +use super::run_unified_format_test; + +#[cfg_attr(feature = "tokio-runtime", tokio::test(flavor = "multi_thread"))] +#[cfg_attr(feature = "async-std-runtime", async_std::test)] +async fn run() { + let _guard: RwLockWriteGuard<()> = LOCK.run_exclusively().await; + run_spec_test(&["crud", "unified"], run_unified_format_test).await; +} diff --git a/src/test/spec/json/crud/unified/aggregate-merge.json b/src/test/spec/json/crud/unified/aggregate-merge.json new file mode 100644 index 000000000..ac61ceb8a --- /dev/null +++ b/src/test/spec/json/crud/unified/aggregate-merge.json @@ -0,0 +1,497 @@ +{ + "description": "aggregate-merge", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.1.11" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_aggregate_merge" + } + }, + { + "collection": { + "id": "collection_readConcern_majority", + "database": "database0", + "collectionName": "test_aggregate_merge", + "collectionOptions": { + "readConcern": { + "level": "majority" + } + } + } + }, + { + "collection": { + "id": "collection_readConcern_local", + "database": "database0", + "collectionName": "test_aggregate_merge", + "collectionOptions": { + "readConcern": { + "level": "local" + } + } + } + }, + { + "collection": { + "id": "collection_readConcern_available", + "database": "database0", + "collectionName": "test_aggregate_merge", + "collectionOptions": { + "readConcern": { + "level": "available" + } + } + } + } + ], + "initialData": [ + { + "collectionName": "test_aggregate_merge", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "Aggregate with $merge", + "operations": [ + { + "object": "collection0", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test_aggregate_merge", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "other_test_collection", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "Aggregate with $merge and batch size of 0", + "operations": [ + { + "object": "collection0", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ], + "batchSize": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test_aggregate_merge", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ], + "cursor": {} + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "other_test_collection", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "Aggregate with $merge and majority readConcern", + "operations": [ + { + "object": "collection_readConcern_majority", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test_aggregate_merge", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ], + "readConcern": { + "level": "majority" + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "other_test_collection", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "Aggregate with $merge and local readConcern", + "operations": [ + { + "object": "collection_readConcern_local", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test_aggregate_merge", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ], + "readConcern": { + "level": "local" + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "other_test_collection", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "Aggregate with $merge and available readConcern", + "operations": [ + { + "object": "collection_readConcern_available", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test_aggregate_merge", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ], + "readConcern": { + "level": "available" + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "other_test_collection", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/aggregate-merge.yml b/src/test/spec/json/crud/unified/aggregate-merge.yml new file mode 100644 index 000000000..821f03e1c --- /dev/null +++ b/src/test/spec/json/crud/unified/aggregate-merge.yml @@ -0,0 +1,185 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: aggregate-merge +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.1.11 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_aggregate_merge + - + collection: + id: &collection_readConcern_majority collection_readConcern_majority + database: database0 + collectionName: *collection_name + collectionOptions: + readConcern: { level: "majority" } + - + collection: + id: &collection_readConcern_local collection_readConcern_local + database: database0 + collectionName: *collection_name + collectionOptions: + readConcern: { level: "local" } + - + collection: + id: &collection_readConcern_available collection_readConcern_available + database: database0 + collectionName: *collection_name + collectionOptions: + readConcern: { level: "available" } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'Aggregate with $merge' + operations: + - + object: *collection0 + name: aggregate + arguments: &arguments + pipeline: &pipeline + - + $sort: + x: 1 + - + $match: + _id: + $gt: 1 + - + $merge: + into: &output_collection other_test_collection + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: *pipeline + outcome: &outcome + - + collectionName: *output_collection + databaseName: *database_name + documents: + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + description: 'Aggregate with $merge and batch size of 0' + operations: + - + object: *collection0 + name: aggregate + arguments: + pipeline: &pipeline + - + $sort: + x: 1 + - + $match: + _id: + $gt: 1 + - + $merge: + into: &output_collection other_test_collection + batchSize: 0 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: *pipeline + cursor: { } + outcome: *outcome + - + description: 'Aggregate with $merge and majority readConcern' + operations: + - + object: *collection_readConcern_majority + name: aggregate + arguments: *arguments + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: *pipeline + readConcern: + level: majority + outcome: *outcome + - + description: 'Aggregate with $merge and local readConcern' + operations: + - + object: *collection_readConcern_local + name: aggregate + arguments: *arguments + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: *pipeline + readConcern: + level: local + outcome: *outcome + - + description: 'Aggregate with $merge and available readConcern' + operations: + - + object: *collection_readConcern_available + name: aggregate + arguments: *arguments + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: *pipeline + readConcern: + level: available + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/aggregate-out-readConcern.json b/src/test/spec/json/crud/unified/aggregate-out-readConcern.json new file mode 100644 index 000000000..e293457c1 --- /dev/null +++ b/src/test/spec/json/crud/unified/aggregate-out-readConcern.json @@ -0,0 +1,407 @@ +{ + "description": "aggregate-out-readConcern", + "schemaVersion": "1.4", + "runOnRequirements": [ + { + "minServerVersion": "4.1.0", + "topologies": [ + "replicaset", + "sharded" + ], + "serverless": "forbid" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_aggregate_out_readconcern" + } + }, + { + "collection": { + "id": "collection_readConcern_majority", + "database": "database0", + "collectionName": "test_aggregate_out_readconcern", + "collectionOptions": { + "readConcern": { + "level": "majority" + } + } + } + }, + { + "collection": { + "id": "collection_readConcern_local", + "database": "database0", + "collectionName": "test_aggregate_out_readconcern", + "collectionOptions": { + "readConcern": { + "level": "local" + } + } + } + }, + { + "collection": { + "id": "collection_readConcern_available", + "database": "database0", + "collectionName": "test_aggregate_out_readconcern", + "collectionOptions": { + "readConcern": { + "level": "available" + } + } + } + }, + { + "collection": { + "id": "collection_readConcern_linearizable", + "database": "database0", + "collectionName": "test_aggregate_out_readconcern", + "collectionOptions": { + "readConcern": { + "level": "linearizable" + } + } + } + } + ], + "initialData": [ + { + "collectionName": "test_aggregate_out_readconcern", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "readConcern majority with out stage", + "operations": [ + { + "object": "collection_readConcern_majority", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "other_test_collection" + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test_aggregate_out_readconcern", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "other_test_collection" + } + ], + "readConcern": { + "level": "majority" + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "other_test_collection", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "readConcern local with out stage", + "operations": [ + { + "object": "collection_readConcern_local", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "other_test_collection" + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test_aggregate_out_readconcern", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "other_test_collection" + } + ], + "readConcern": { + "level": "local" + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "other_test_collection", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "readConcern available with out stage", + "operations": [ + { + "object": "collection_readConcern_available", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "other_test_collection" + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test_aggregate_out_readconcern", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "other_test_collection" + } + ], + "readConcern": { + "level": "available" + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "other_test_collection", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "readConcern linearizable with out stage", + "operations": [ + { + "object": "collection_readConcern_linearizable", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "other_test_collection" + } + ] + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test_aggregate_out_readconcern", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "other_test_collection" + } + ], + "readConcern": { + "level": "linearizable" + } + } + } + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/aggregate-out-readConcern.yml b/src/test/spec/json/crud/unified/aggregate-out-readConcern.yml new file mode 100644 index 000000000..c210c4692 --- /dev/null +++ b/src/test/spec/json/crud/unified/aggregate-out-readConcern.yml @@ -0,0 +1,171 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: aggregate-out-readConcern +schemaVersion: '1.4' +runOnRequirements: + - + minServerVersion: 4.1.0 + topologies: + - replicaset + - sharded + serverless: "forbid" +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_aggregate_out_readconcern + - + collection: + id: &collection_readConcern_majority collection_readConcern_majority + database: database0 + collectionName: *collection_name + collectionOptions: + readConcern: { level: "majority" } + - + collection: + id: &collection_readConcern_local collection_readConcern_local + database: database0 + collectionName: *collection_name + collectionOptions: + readConcern: { level: "local" } + - + collection: + id: &collection_readConcern_available collection_readConcern_available + database: database0 + collectionName: *collection_name + collectionOptions: + readConcern: { level: "available" } + - + collection: + id: &collection_readConcern_linearizable collection_readConcern_linearizable + database: database0 + collectionName: *collection_name + collectionOptions: + readConcern: { level: "linearizable" } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'readConcern majority with out stage' + operations: + - + object: *collection_readConcern_majority + name: aggregate + arguments: &arguments + pipeline: + - + $sort: + x: 1 + - + $match: + _id: + $gt: 1 + - + $out: &output_collection other_test_collection + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: &pipeline + - { $sort: { x: 1 } } + - { $match: { _id: { $gt: 1 } } } + - { $out: other_test_collection } + readConcern: + level: majority + outcome: &outcome + - + collectionName: *output_collection + databaseName: *database_name + documents: + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + description: 'readConcern local with out stage' + operations: + - + object: *collection_readConcern_local + name: aggregate + arguments: *arguments + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: *pipeline + readConcern: + level: local + outcome: *outcome + - + description: 'readConcern available with out stage' + operations: + - + object: *collection_readConcern_available + name: aggregate + arguments: *arguments + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: *pipeline + readConcern: + level: available + outcome: *outcome + - + description: 'readConcern linearizable with out stage' + operations: + - + object: *collection_readConcern_linearizable + name: aggregate + arguments: *arguments + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: *pipeline + readConcern: + level: linearizable diff --git a/src/test/spec/json/crud/unified/aggregate.json b/src/test/spec/json/crud/unified/aggregate.json new file mode 100644 index 000000000..dcdad761e --- /dev/null +++ b/src/test/spec/json/crud/unified/aggregate.json @@ -0,0 +1,166 @@ +{ + "description": "aggregate", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "aggregate-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "aggregate-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + }, + { + "_id": 5, + "x": 55 + }, + { + "_id": 6, + "x": 66 + } + ] + } + ], + "tests": [ + { + "description": "aggregate with multiple batches works", + "operations": [ + { + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$match": { + "_id": { + "$gt": 1 + } + } + } + ], + "batchSize": 2 + }, + "object": "collection0", + "expectResult": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + }, + { + "_id": 5, + "x": 55 + }, + { + "_id": 6, + "x": 66 + } + ] + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "coll0", + "pipeline": [ + { + "$match": { + "_id": { + "$gt": 1 + } + } + } + ], + "cursor": { + "batchSize": 2 + } + }, + "commandName": "aggregate", + "databaseName": "aggregate-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "coll0", + "batchSize": 2 + }, + "commandName": "getMore", + "databaseName": "aggregate-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "coll0", + "batchSize": 2 + }, + "commandName": "getMore", + "databaseName": "aggregate-tests" + } + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/aggregate.yml b/src/test/spec/json/crud/unified/aggregate.yml new file mode 100644 index 000000000..248b91cef --- /dev/null +++ b/src/test/spec/json/crud/unified/aggregate.yml @@ -0,0 +1,68 @@ +description: "aggregate" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true # ensure cursors pin to a single server + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name aggregate-tests + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + - { _id: 4, x: 44 } + - { _id: 5, x: 55 } + - { _id: 6, x: 66 } + +tests: + - description: "aggregate with multiple batches works" + operations: + - name: aggregate + arguments: + pipeline: [ { $match: { _id: { $gt: 1 } }} ] + batchSize: 2 + object: *collection0 + expectResult: + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + - { _id: 4, x: 44 } + - { _id: 5, x: 55 } + - { _id: 6, x: 66 } + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + aggregate: *collection0Name + pipeline: [ { $match: { _id: { $gt: 1 } }} ] + cursor: { batchSize: 2 } + commandName: aggregate + databaseName: *database0Name + - commandStartedEvent: + command: + getMore: { $$type: [ int, long ] } + collection: *collection0Name + batchSize: 2 + commandName: getMore + databaseName: *database0Name + - commandStartedEvent: + command: + getMore: { $$type: [ int, long ] } + collection: *collection0Name + batchSize: 2 + commandName: getMore + databaseName: *database0Name + diff --git a/src/test/spec/json/crud/unified/bulkWrite-arrayFilters-clientError.json b/src/test/spec/json/crud/unified/bulkWrite-arrayFilters-clientError.json new file mode 100644 index 000000000..63815e323 --- /dev/null +++ b/src/test/spec/json/crud/unified/bulkWrite-arrayFilters-clientError.json @@ -0,0 +1,151 @@ +{ + "description": "bulkWrite-arrayFilters-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "maxServerVersion": "3.5.5" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "crud-v2" + } + } + ], + "initialData": [ + { + "collectionName": "crud-v2", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 1 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + } + ] + } + ], + "tests": [ + { + "description": "BulkWrite on server that doesn't support arrayFilters", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateOne": { + "filter": {}, + "update": { + "$set": { + "y.0.b": 2 + } + }, + "arrayFilters": [ + { + "i.b": 1 + } + ] + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + }, + { + "description": "BulkWrite on server that doesn't support arrayFilters with arrayFilters on second op", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateOne": { + "filter": {}, + "update": { + "$set": { + "y.0.b": 2 + } + } + } + }, + { + "updateMany": { + "filter": {}, + "update": { + "$set": { + "y.$[i].b": 2 + } + }, + "arrayFilters": [ + { + "i.b": 1 + } + ] + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/bulkWrite-arrayFilters-clientError.yml b/src/test/spec/json/crud/unified/bulkWrite-arrayFilters-clientError.yml new file mode 100644 index 000000000..8b4c7a1c9 --- /dev/null +++ b/src/test/spec/json/crud/unified/bulkWrite-arrayFilters-clientError.yml @@ -0,0 +1,98 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: bulkWrite-arrayFilters-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 3.5.5 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name crud-v2 +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + 'y': + - + b: 3 + - + b: 1 + - + _id: 2 + 'y': + - + b: 0 + - + b: 1 +tests: + - + description: 'BulkWrite on server that doesn''t support arrayFilters' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateOne: + filter: { } + update: + $set: + y.0.b: 2 + arrayFilters: + - + i.b: 1 + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + - + description: 'BulkWrite on server that doesn''t support arrayFilters with arrayFilters on second op' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateOne: + filter: { } + update: + $set: + y.0.b: 2 + - + updateMany: + filter: { } + update: + $set: + 'y.$[i].b': 2 + arrayFilters: + - + i.b: 1 + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] diff --git a/src/test/spec/json/crud/unified/bulkWrite-arrayFilters.json b/src/test/spec/json/crud/unified/bulkWrite-arrayFilters.json new file mode 100644 index 000000000..70ee014f7 --- /dev/null +++ b/src/test/spec/json/crud/unified/bulkWrite-arrayFilters.json @@ -0,0 +1,279 @@ +{ + "description": "bulkWrite-arrayFilters", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "3.5.6" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 1 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + } + ] + } + ], + "tests": [ + { + "description": "BulkWrite updateOne with arrayFilters", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateOne": { + "filter": {}, + "update": { + "$set": { + "y.$[i].b": 2 + } + }, + "arrayFilters": [ + { + "i.b": 3 + } + ] + } + } + ], + "ordered": true + }, + "expectResult": { + "deletedCount": 0, + "insertedCount": 0, + "insertedIds": { + "$$unsetOrMatches": {} + }, + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0, + "upsertedIds": {} + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": {}, + "u": { + "$set": { + "y.$[i].b": 2 + } + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + }, + "arrayFilters": [ + { + "i.b": 3 + } + ] + } + ], + "ordered": true + }, + "commandName": "update", + "databaseName": "crud-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "y": [ + { + "b": 2 + }, + { + "b": 1 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + } + ] + } + ] + }, + { + "description": "BulkWrite updateMany with arrayFilters", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateMany": { + "filter": {}, + "update": { + "$set": { + "y.$[i].b": 2 + } + }, + "arrayFilters": [ + { + "i.b": 1 + } + ] + } + } + ], + "ordered": true + }, + "expectResult": { + "deletedCount": 0, + "insertedCount": 0, + "insertedIds": { + "$$unsetOrMatches": {} + }, + "matchedCount": 2, + "modifiedCount": 2, + "upsertedCount": 0, + "upsertedIds": {} + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": {}, + "u": { + "$set": { + "y.$[i].b": 2 + } + }, + "multi": true, + "upsert": { + "$$unsetOrMatches": false + }, + "arrayFilters": [ + { + "i.b": 1 + } + ] + } + ], + "ordered": true + }, + "commandName": "update", + "databaseName": "crud-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 2 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 2 + } + ] + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/bulkWrite-arrayFilters.yml b/src/test/spec/json/crud/unified/bulkWrite-arrayFilters.yml new file mode 100644 index 000000000..a236acb12 --- /dev/null +++ b/src/test/spec/json/crud/unified/bulkWrite-arrayFilters.yml @@ -0,0 +1,174 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: bulkWrite-arrayFilters +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 3.5.6 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-tests + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + 'y': + - + b: 3 + - + b: 1 + - + _id: 2 + 'y': + - + b: 0 + - + b: 1 +tests: + - + description: 'BulkWrite updateOne with arrayFilters' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateOne: + filter: { } + update: + $set: + 'y.$[i].b': 2 + arrayFilters: + - + i.b: 3 + ordered: true + expectResult: + deletedCount: 0 + insertedCount: 0 + insertedIds: { $$unsetOrMatches: {} } + matchedCount: 1 + modifiedCount: 1 + upsertedCount: 0 + upsertedIds: { } + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: { } + u: + $set: { 'y.$[i].b': 2 } + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } + arrayFilters: + - { i.b: 3 } + ordered: true + commandName: update + databaseName: *database_name + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + 'y': + - + b: 2 + - + b: 1 + - + _id: 2 + 'y': + - + b: 0 + - + b: 1 + - + description: 'BulkWrite updateMany with arrayFilters' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateMany: + filter: { } + update: + $set: + 'y.$[i].b': 2 + arrayFilters: + - + i.b: 1 + ordered: true + expectResult: + deletedCount: 0 + insertedCount: 0 + insertedIds: { $$unsetOrMatches: {} } + matchedCount: 2 + modifiedCount: 2 + upsertedCount: 0 + upsertedIds: { } + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: { } + u: + $set: { 'y.$[i].b': 2 } + multi: true + upsert: { $$unsetOrMatches: false } + arrayFilters: + - { i.b: 1 } + ordered: true + commandName: update + databaseName: *database_name + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + 'y': + - + b: 3 + - + b: 2 + - + _id: 2 + 'y': + - + b: 0 + - + b: 2 diff --git a/src/test/spec/json/crud/unified/bulkWrite-delete-hint-clientError.json b/src/test/spec/json/crud/unified/bulkWrite-delete-hint-clientError.json new file mode 100644 index 000000000..2961b55dc --- /dev/null +++ b/src/test/spec/json/crud/unified/bulkWrite-delete-hint-clientError.json @@ -0,0 +1,193 @@ +{ + "description": "bulkWrite-delete-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "maxServerVersion": "3.3.99" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "BulkWrite_delete_hint" + } + } + ], + "initialData": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ], + "tests": [ + { + "description": "BulkWrite deleteOne with hints unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "deleteOne": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + } + }, + { + "deleteOne": { + "filter": { + "_id": 2 + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_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": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "deleteMany": { + "filter": { + "_id": { + "$lt": 3 + } + }, + "hint": "_id_" + } + }, + { + "deleteMany": { + "filter": { + "_id": { + "$gte": 4 + } + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/bulkWrite-delete-hint-clientError.yml b/src/test/spec/json/crud/unified/bulkWrite-delete-hint-clientError.yml new file mode 100644 index 000000000..2b0bdb1c2 --- /dev/null +++ b/src/test/spec/json/crud/unified/bulkWrite-delete-hint-clientError.yml @@ -0,0 +1,113 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: bulkWrite-delete-hint-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 3.3.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name BulkWrite_delete_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 +tests: + - + description: 'BulkWrite deleteOne with hints unsupported (client-side error)' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + deleteOne: + filter: &deleteOne_filter1 + _id: 1 + hint: &hint_string _id_ + - + deleteOne: + filter: &deleteOne_filter2 + _id: 2 + hint: &hint_doc + _id: 1 + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _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: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + deleteMany: + filter: &deleteMany_filter1 + _id: + $lt: 3 + hint: *hint_string + - + deleteMany: + filter: &deleteMany_filter2 + _id: + $gte: 4 + hint: *hint_doc + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/bulkWrite-delete-hint-serverError.json b/src/test/spec/json/crud/unified/bulkWrite-delete-hint-serverError.json new file mode 100644 index 000000000..fa9952209 --- /dev/null +++ b/src/test/spec/json/crud/unified/bulkWrite-delete-hint-serverError.json @@ -0,0 +1,252 @@ +{ + "description": "bulkWrite-delete-hint-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.3.3" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "BulkWrite_delete_hint" + } + } + ], + "initialData": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ], + "tests": [ + { + "description": "BulkWrite deleteOne with hints unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "deleteOne": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + } + }, + { + "deleteOne": { + "filter": { + "_id": 2 + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "BulkWrite_delete_hint", + "deletes": [ + { + "q": { + "_id": 1 + }, + "hint": "_id_", + "limit": 1 + }, + { + "q": { + "_id": 2 + }, + "hint": { + "_id": 1 + }, + "limit": 1 + } + ], + "ordered": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_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": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "deleteMany": { + "filter": { + "_id": { + "$lt": 3 + } + }, + "hint": "_id_" + } + }, + { + "deleteMany": { + "filter": { + "_id": { + "$gte": 4 + } + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "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": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/bulkWrite-delete-hint-serverError.yml b/src/test/spec/json/crud/unified/bulkWrite-delete-hint-serverError.yml new file mode 100644 index 000000000..e757bade0 --- /dev/null +++ b/src/test/spec/json/crud/unified/bulkWrite-delete-hint-serverError.yml @@ -0,0 +1,142 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: bulkWrite-delete-hint-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 3.4.0 + maxServerVersion: 4.3.3 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name BulkWrite_delete_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 +tests: + - + description: 'BulkWrite deleteOne with hints unsupported (server-side error)' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + deleteOne: + filter: &deleteOne_filter1 + _id: 1 + hint: &hint_string _id_ + - + deleteOne: + filter: &deleteOne_filter2 + _id: 2 + hint: &hint_doc + _id: 1 + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *deleteOne_filter1 + hint: *hint_string + limit: 1 + - + q: *deleteOne_filter2 + hint: *hint_doc + limit: 1 + ordered: true + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _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: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + deleteMany: + filter: &deleteMany_filter1 + _id: + $lt: 3 + hint: *hint_string + - + deleteMany: + filter: &deleteMany_filter2 + _id: + $gte: 4 + hint: *hint_doc + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *deleteMany_filter1 + hint: *hint_string + limit: 0 + - + q: *deleteMany_filter2 + hint: *hint_doc + limit: 0 + ordered: true + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/bulkWrite-delete-hint.json b/src/test/spec/json/crud/unified/bulkWrite-delete-hint.json new file mode 100644 index 000000000..9fcdecefd --- /dev/null +++ b/src/test/spec/json/crud/unified/bulkWrite-delete-hint.json @@ -0,0 +1,247 @@ +{ + "description": "bulkWrite-delete-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.3.4" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "BulkWrite_delete_hint" + } + } + ], + "initialData": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ], + "tests": [ + { + "description": "BulkWrite deleteOne with hints", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "deleteOne": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + } + }, + { + "deleteOne": { + "filter": { + "_id": 2 + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectResult": { + "deletedCount": 2, + "insertedCount": 0, + "insertedIds": { + "$$unsetOrMatches": {} + }, + "matchedCount": 0, + "modifiedCount": 0, + "upsertedCount": 0, + "upsertedIds": {} + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "BulkWrite_delete_hint", + "deletes": [ + { + "q": { + "_id": 1 + }, + "hint": "_id_", + "limit": 1 + }, + { + "q": { + "_id": 2 + }, + "hint": { + "_id": 1 + }, + "limit": 1 + } + ], + "ordered": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + }, + { + "description": "BulkWrite deleteMany with hints", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "deleteMany": { + "filter": { + "_id": { + "$lt": 3 + } + }, + "hint": "_id_" + } + }, + { + "deleteMany": { + "filter": { + "_id": { + "$gte": 4 + } + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectResult": { + "deletedCount": 3, + "insertedCount": 0, + "insertedIds": { + "$$unsetOrMatches": {} + }, + "matchedCount": 0, + "modifiedCount": 0, + "upsertedCount": 0, + "upsertedIds": {} + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "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": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 3, + "x": 33 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/bulkWrite-delete-hint.yml b/src/test/spec/json/crud/unified/bulkWrite-delete-hint.yml new file mode 100644 index 000000000..8b7f84aa9 --- /dev/null +++ b/src/test/spec/json/crud/unified/bulkWrite-delete-hint.yml @@ -0,0 +1,154 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: bulkWrite-delete-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.3.4 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name BulkWrite_delete_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 +tests: + - + description: 'BulkWrite deleteOne with hints' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + deleteOne: + filter: &deleteOne_filter1 + _id: 1 + hint: &hint_string _id_ + - + deleteOne: + filter: &deleteOne_filter2 + _id: 2 + hint: &hint_doc + _id: 1 + ordered: true + expectResult: + deletedCount: 2 + insertedCount: 0 + insertedIds: { $$unsetOrMatches: {} } + matchedCount: 0 + modifiedCount: 0 + upsertedCount: 0 + upsertedIds: { } + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *deleteOne_filter1 + hint: *hint_string + limit: 1 + - + q: *deleteOne_filter2 + hint: *hint_doc + limit: 1 + ordered: true + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 + - + description: 'BulkWrite deleteMany with hints' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + deleteMany: + filter: &deleteMany_filter1 + _id: + $lt: 3 + hint: *hint_string + - + deleteMany: + filter: &deleteMany_filter2 + _id: + $gte: 4 + hint: *hint_doc + ordered: true + expectResult: + deletedCount: 3 + insertedCount: 0 + insertedIds: { $$unsetOrMatches: {} } + matchedCount: 0 + modifiedCount: 0 + upsertedCount: 0 + upsertedIds: { } + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *deleteMany_filter1 + hint: *hint_string + limit: 0 + - + q: *deleteMany_filter2 + hint: *hint_doc + limit: 0 + ordered: true + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 3 + x: 33 diff --git a/src/test/spec/json/crud/unified/bulkWrite-update-hint-clientError.json b/src/test/spec/json/crud/unified/bulkWrite-update-hint-clientError.json new file mode 100644 index 000000000..d5eb71c29 --- /dev/null +++ b/src/test/spec/json/crud/unified/bulkWrite-update-hint-clientError.json @@ -0,0 +1,284 @@ +{ + "description": "bulkWrite-update-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "maxServerVersion": "3.3.99" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_bulkwrite_update_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ], + "tests": [ + { + "description": "BulkWrite updateOne with update hints unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateOne": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + } + }, + { + "updateOne": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_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": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateMany": { + "filter": { + "_id": { + "$lt": 3 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + } + }, + { + "updateMany": { + "filter": { + "_id": { + "$lt": 3 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_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": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "replaceOne": { + "filter": { + "_id": 3 + }, + "replacement": { + "x": 333 + }, + "hint": "_id_" + } + }, + { + "replaceOne": { + "filter": { + "_id": 4 + }, + "replacement": { + "x": 444 + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/bulkWrite-update-hint-clientError.yml b/src/test/spec/json/crud/unified/bulkWrite-update-hint-clientError.yml new file mode 100644 index 000000000..df1eae485 --- /dev/null +++ b/src/test/spec/json/crud/unified/bulkWrite-update-hint-clientError.yml @@ -0,0 +1,148 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: bulkWrite-update-hint-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 3.3.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_bulkwrite_update_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 +tests: + - + description: 'BulkWrite updateOne with update hints unsupported (client-side error)' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateOne: + filter: &updateOne_filter + _id: 1 + update: &updateOne_update + $inc: + x: 1 + hint: &hint_string _id_ + - + updateOne: + filter: *updateOne_filter + update: *updateOne_update + hint: &hint_doc + _id: 1 + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _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: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateMany: + filter: &updateMany_filter + _id: + $lt: 3 + update: &updateMany_update + $inc: + x: 1 + hint: *hint_string + - + updateMany: + filter: *updateMany_filter + update: *updateMany_update + hint: *hint_doc + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome + - + description: 'BulkWrite replaceOne with update hints unsupported (client-side error)' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + replaceOne: + filter: + _id: 3 + replacement: + x: 333 + hint: *hint_string + - + replaceOne: + filter: + _id: 4 + replacement: + x: 444 + hint: *hint_doc + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/bulkWrite-update-hint-serverError.json b/src/test/spec/json/crud/unified/bulkWrite-update-hint-serverError.json new file mode 100644 index 000000000..b0f7e1b38 --- /dev/null +++ b/src/test/spec/json/crud/unified/bulkWrite-update-hint-serverError.json @@ -0,0 +1,422 @@ +{ + "description": "bulkWrite-update-hint-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.1.9" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_bulkwrite_update_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ], + "tests": [ + { + "description": "BulkWrite updateOne with update hints unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateOne": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + } + }, + { + "updateOne": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_bulkwrite_update_hint", + "updates": [ + { + "q": { + "_id": 1 + }, + "u": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_", + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + }, + { + "q": { + "_id": 1 + }, + "u": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_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": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateMany": { + "filter": { + "_id": { + "$lt": 3 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + } + }, + { + "updateMany": { + "filter": { + "_id": { + "$lt": 3 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_bulkwrite_update_hint", + "updates": [ + { + "q": { + "_id": { + "$lt": 3 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": true, + "hint": "_id_", + "upsert": { + "$$unsetOrMatches": false + } + }, + { + "q": { + "_id": { + "$lt": 3 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": true, + "hint": { + "_id": 1 + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_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": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "replaceOne": { + "filter": { + "_id": 3 + }, + "replacement": { + "x": 333 + }, + "hint": "_id_" + } + }, + { + "replaceOne": { + "filter": { + "_id": 4 + }, + "replacement": { + "x": 444 + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_bulkwrite_update_hint", + "updates": [ + { + "q": { + "_id": 3 + }, + "u": { + "x": 333 + }, + "hint": "_id_", + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + }, + { + "q": { + "_id": 4 + }, + "u": { + "x": 444 + }, + "hint": { + "_id": 1 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/bulkWrite-update-hint-serverError.yml b/src/test/spec/json/crud/unified/bulkWrite-update-hint-serverError.yml new file mode 100644 index 000000000..bda128b55 --- /dev/null +++ b/src/test/spec/json/crud/unified/bulkWrite-update-hint-serverError.yml @@ -0,0 +1,249 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: bulkWrite-update-hint-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 3.4.0 + maxServerVersion: 4.1.9 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_bulkwrite_update_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 +tests: + - + description: 'BulkWrite updateOne with update hints unsupported (server-side error)' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateOne: + filter: &updateOne_filter + _id: 1 + update: &updateOne_update + $inc: + x: 1 + hint: &hint_string _id_ + - + updateOne: + filter: *updateOne_filter + update: *updateOne_update + hint: &hint_doc + _id: 1 + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *updateOne_filter + u: *updateOne_update + hint: *hint_string + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + - + q: *updateOne_filter + u: *updateOne_update + hint: *hint_doc + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + ordered: true + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _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: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateMany: + filter: &updateMany_filter + _id: + $lt: 3 + update: &updateMany_update + $inc: + x: 1 + hint: *hint_string + - + updateMany: + filter: *updateMany_filter + update: *updateMany_update + hint: *hint_doc + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *updateMany_filter + u: *updateMany_update + multi: true + hint: *hint_string + upsert: + $$unsetOrMatches: false + - + q: *updateMany_filter + u: *updateMany_update + multi: true + hint: *hint_doc + upsert: + $$unsetOrMatches: false + ordered: true + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _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: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + replaceOne: + filter: + _id: 3 + replacement: + x: 333 + hint: *hint_string + - + replaceOne: + filter: + _id: 4 + replacement: + x: 444 + hint: *hint_doc + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: 3 + u: + x: 333 + hint: *hint_string + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + - + q: + _id: 4 + u: + x: 444 + hint: *hint_doc + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + ordered: true + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 diff --git a/src/test/spec/json/crud/unified/bulkWrite-update-hint.json b/src/test/spec/json/crud/unified/bulkWrite-update-hint.json new file mode 100644 index 000000000..420635989 --- /dev/null +++ b/src/test/spec/json/crud/unified/bulkWrite-update-hint.json @@ -0,0 +1,445 @@ +{ + "description": "bulkWrite-update-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.2.0" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_bulkwrite_update_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ], + "tests": [ + { + "description": "BulkWrite updateOne with update hints", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateOne": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + } + }, + { + "updateOne": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectResult": { + "deletedCount": 0, + "insertedCount": 0, + "insertedIds": { + "$$unsetOrMatches": {} + }, + "matchedCount": 2, + "modifiedCount": 2, + "upsertedCount": 0, + "upsertedIds": {} + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_bulkwrite_update_hint", + "updates": [ + { + "q": { + "_id": 1 + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + }, + "hint": "_id_" + }, + { + "q": { + "_id": 1 + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + }, + "hint": { + "_id": 1 + } + } + ], + "ordered": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 13 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + }, + { + "description": "BulkWrite updateMany with update hints", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateMany": { + "filter": { + "_id": { + "$lt": 3 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + } + }, + { + "updateMany": { + "filter": { + "_id": { + "$lt": 3 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectResult": { + "deletedCount": 0, + "insertedCount": 0, + "insertedIds": { + "$$unsetOrMatches": {} + }, + "matchedCount": 4, + "modifiedCount": 4, + "upsertedCount": 0, + "upsertedIds": {} + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_bulkwrite_update_hint", + "updates": [ + { + "q": { + "_id": { + "$lt": 3 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": true, + "upsert": { + "$$unsetOrMatches": false + }, + "hint": "_id_" + }, + { + "q": { + "_id": { + "$lt": 3 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": true, + "upsert": { + "$$unsetOrMatches": false + }, + "hint": { + "_id": 1 + } + } + ], + "ordered": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 13 + }, + { + "_id": 2, + "x": 24 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + }, + { + "description": "BulkWrite replaceOne with update hints", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "replaceOne": { + "filter": { + "_id": 3 + }, + "replacement": { + "x": 333 + }, + "hint": "_id_" + } + }, + { + "replaceOne": { + "filter": { + "_id": 4 + }, + "replacement": { + "x": 444 + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectResult": { + "deletedCount": 0, + "insertedCount": 0, + "insertedIds": { + "$$unsetOrMatches": {} + }, + "matchedCount": 2, + "modifiedCount": 2, + "upsertedCount": 0, + "upsertedIds": {} + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_bulkwrite_update_hint", + "updates": [ + { + "q": { + "_id": 3 + }, + "u": { + "x": 333 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + }, + "hint": "_id_" + }, + { + "q": { + "_id": 4 + }, + "u": { + "x": 444 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + }, + "hint": { + "_id": 1 + } + } + ], + "ordered": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 333 + }, + { + "_id": 4, + "x": 444 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/bulkWrite-update-hint.yml b/src/test/spec/json/crud/unified/bulkWrite-update-hint.yml new file mode 100644 index 000000000..9f5a0e080 --- /dev/null +++ b/src/test/spec/json/crud/unified/bulkWrite-update-hint.yml @@ -0,0 +1,256 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: bulkWrite-update-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.2.0 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_bulkwrite_update_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 +tests: + - + description: 'BulkWrite updateOne with update hints' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateOne: + filter: &updateOne_filter + _id: 1 + update: &updateOne_update + $inc: + x: 1 + hint: &hint_string _id_ + - + updateOne: + filter: *updateOne_filter + update: *updateOne_update + hint: &hint_doc + _id: 1 + ordered: true + expectResult: + deletedCount: 0 + insertedCount: 0 + insertedIds: { $$unsetOrMatches: {} } + matchedCount: 2 + modifiedCount: 2 + upsertedCount: 0 + upsertedIds: { } + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *updateOne_filter + u: *updateOne_update + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } + hint: *hint_string + - + q: *updateOne_filter + u: *updateOne_update + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } + hint: *hint_doc + ordered: true + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 13 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 + - + description: 'BulkWrite updateMany with update hints' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateMany: + filter: &updateMany_filter + _id: + $lt: 3 + update: &updateMany_update + $inc: + x: 1 + hint: *hint_string + - + updateMany: + filter: *updateMany_filter + update: *updateMany_update + hint: *hint_doc + ordered: true + expectResult: + deletedCount: 0 + insertedCount: 0 + insertedIds: { $$unsetOrMatches: {} } + matchedCount: 4 + modifiedCount: 4 + upsertedCount: 0 + upsertedIds: { } + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *updateMany_filter + u: *updateMany_update + multi: true + upsert: { $$unsetOrMatches: false } + hint: *hint_string + - + q: *updateMany_filter + u: *updateMany_update + multi: true + upsert: { $$unsetOrMatches: false } + hint: *hint_doc + ordered: true + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 13 + - + _id: 2 + x: 24 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 + - + description: 'BulkWrite replaceOne with update hints' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + replaceOne: + filter: + _id: 3 + replacement: + x: 333 + hint: *hint_string + - + replaceOne: + filter: + _id: 4 + replacement: + x: 444 + hint: *hint_doc + ordered: true + expectResult: + deletedCount: 0 + insertedCount: 0 + insertedIds: { $$unsetOrMatches: {} } + matchedCount: 2 + modifiedCount: 2 + upsertedCount: 0 + upsertedIds: { } + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: 3 + u: + x: 333 + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } + hint: *hint_string + - + q: + _id: 4 + u: + x: 444 + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } + hint: *hint_doc + ordered: true + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 333 + - + _id: 4 + x: 444 diff --git a/src/test/spec/json/crud/unified/db-aggregate.json b/src/test/spec/json/crud/unified/db-aggregate.json new file mode 100644 index 000000000..5015405bf --- /dev/null +++ b/src/test/spec/json/crud/unified/db-aggregate.json @@ -0,0 +1,107 @@ +{ + "description": "db-aggregate", + "schemaVersion": "1.4", + "runOnRequirements": [ + { + "minServerVersion": "3.6.0", + "serverless": "forbid" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "admin" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "crud-v2" + } + } + ], + "tests": [ + { + "description": "Aggregate with $listLocalSessions", + "operations": [ + { + "object": "database0", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$listLocalSessions": {} + }, + { + "$limit": 1 + }, + { + "$addFields": { + "dummy": "dummy field" + } + }, + { + "$project": { + "_id": 0, + "dummy": 1 + } + } + ] + }, + "expectResult": [ + { + "dummy": "dummy field" + } + ] + } + ] + }, + { + "description": "Aggregate with $listLocalSessions and allowDiskUse", + "operations": [ + { + "object": "database0", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$listLocalSessions": {} + }, + { + "$limit": 1 + }, + { + "$addFields": { + "dummy": "dummy field" + } + }, + { + "$project": { + "_id": 0, + "dummy": 1 + } + } + ], + "allowDiskUse": true + }, + "expectResult": [ + { + "dummy": "dummy field" + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/db-aggregate.yml b/src/test/spec/json/crud/unified/db-aggregate.yml new file mode 100644 index 000000000..032f94c73 --- /dev/null +++ b/src/test/spec/json/crud/unified/db-aggregate.yml @@ -0,0 +1,73 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: db-aggregate +schemaVersion: '1.4' +runOnRequirements: + - + minServerVersion: 3.6.0 + # serverless does not support either of the current database-level aggregation stages ($listLocalSessions and + # $currentOp) + serverless: forbid +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name admin + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name crud-v2 +tests: + - + description: 'Aggregate with $listLocalSessions' + operations: + - + object: *database0 + name: aggregate + arguments: + pipeline: + - + $listLocalSessions: { } + - + $limit: 1 + - + $addFields: + dummy: 'dummy field' + - + $project: + _id: 0 + dummy: 1 + expectResult: + - + dummy: 'dummy field' + - + description: 'Aggregate with $listLocalSessions and allowDiskUse' + operations: + - + object: *database0 + name: aggregate + arguments: + pipeline: + - + $listLocalSessions: { } + - + $limit: 1 + - + $addFields: + dummy: 'dummy field' + - + $project: + _id: 0 + dummy: 1 + allowDiskUse: true + expectResult: + - + dummy: 'dummy field' diff --git a/src/test/spec/json/crud/unified/deleteMany-hint-clientError.json b/src/test/spec/json/crud/unified/deleteMany-hint-clientError.json new file mode 100644 index 000000000..66320122b --- /dev/null +++ b/src/test/spec/json/crud/unified/deleteMany-hint-clientError.json @@ -0,0 +1,149 @@ +{ + "description": "deleteMany-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "maxServerVersion": "3.3.99" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "DeleteMany_hint" + } + } + ], + "initialData": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "DeleteMany with hint string unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "DeleteMany with hint document unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/deleteMany-hint-clientError.yml b/src/test/spec/json/crud/unified/deleteMany-hint-clientError.yml new file mode 100644 index 000000000..21ff1debb --- /dev/null +++ b/src/test/spec/json/crud/unified/deleteMany-hint-clientError.yml @@ -0,0 +1,87 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: deleteMany-hint-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 3.3.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name DeleteMany_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'DeleteMany with hint string unsupported (client-side error)' + operations: + - + object: *collection0 + name: deleteMany + arguments: + filter: &filter + _id: + $gt: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + description: 'DeleteMany with hint document unsupported (client-side error)' + operations: + - + object: *collection0 + name: deleteMany + arguments: + filter: *filter + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/deleteMany-hint-serverError.json b/src/test/spec/json/crud/unified/deleteMany-hint-serverError.json new file mode 100644 index 000000000..88d4a6557 --- /dev/null +++ b/src/test/spec/json/crud/unified/deleteMany-hint-serverError.json @@ -0,0 +1,190 @@ +{ + "description": "deleteMany-hint-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.3.3" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "DeleteMany_hint" + } + } + ], + "initialData": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "DeleteMany with hint string unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "DeleteMany_hint", + "deletes": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "hint": "_id_", + "limit": 0 + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "DeleteMany with hint document unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "DeleteMany_hint", + "deletes": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "hint": { + "_id": 1 + }, + "limit": 0 + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/deleteMany-hint-serverError.yml b/src/test/spec/json/crud/unified/deleteMany-hint-serverError.yml new file mode 100644 index 000000000..2e20988d0 --- /dev/null +++ b/src/test/spec/json/crud/unified/deleteMany-hint-serverError.yml @@ -0,0 +1,107 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: deleteMany-hint-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 3.4.0 + maxServerVersion: 4.3.3 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name DeleteMany_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'DeleteMany with hint string unsupported (server-side error)' + operations: + - + object: *collection0 + name: deleteMany + arguments: + filter: &filter + _id: + $gt: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *filter + hint: _id_ + limit: 0 + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + description: 'DeleteMany with hint document unsupported (server-side error)' + operations: + - + object: *collection0 + name: deleteMany + arguments: + filter: *filter + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *filter + hint: + _id: 1 + limit: 0 + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/deleteMany-hint.json b/src/test/spec/json/crud/unified/deleteMany-hint.json new file mode 100644 index 000000000..59d903d20 --- /dev/null +++ b/src/test/spec/json/crud/unified/deleteMany-hint.json @@ -0,0 +1,173 @@ +{ + "description": "deleteMany-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.3.4" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "DeleteMany_hint" + } + } + ], + "initialData": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "DeleteMany with hint string", + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": "_id_" + }, + "expectResult": { + "deletedCount": 2 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "DeleteMany_hint", + "deletes": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "hint": "_id_", + "limit": 0 + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ] + }, + { + "description": "DeleteMany with hint document", + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectResult": { + "deletedCount": 2 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "DeleteMany_hint", + "deletes": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "hint": { + "_id": 1 + }, + "limit": 0 + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/deleteMany-hint.yml b/src/test/spec/json/crud/unified/deleteMany-hint.yml new file mode 100644 index 000000000..512b95e76 --- /dev/null +++ b/src/test/spec/json/crud/unified/deleteMany-hint.yml @@ -0,0 +1,99 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: deleteMany-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.3.4 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name DeleteMany_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'DeleteMany with hint string' + operations: + - + object: *collection0 + name: deleteMany + arguments: + filter: &filter + _id: + $gt: 1 + hint: _id_ + expectResult: &result + deletedCount: 2 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *filter + hint: _id_ + limit: 0 + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + description: 'DeleteMany with hint document' + operations: + - + object: *collection0 + name: deleteMany + arguments: + filter: *filter + hint: + _id: 1 + expectResult: *result + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *filter + hint: + _id: 1 + limit: 0 + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/deleteOne-hint-clientError.json b/src/test/spec/json/crud/unified/deleteOne-hint-clientError.json new file mode 100644 index 000000000..cf629f59e --- /dev/null +++ b/src/test/spec/json/crud/unified/deleteOne-hint-clientError.json @@ -0,0 +1,133 @@ +{ + "description": "deleteOne-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "maxServerVersion": "3.3.99" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "DeleteOne_hint" + } + } + ], + "initialData": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "DeleteOne with hint string unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "DeleteOne with hint document unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/deleteOne-hint-clientError.yml b/src/test/spec/json/crud/unified/deleteOne-hint-clientError.yml new file mode 100644 index 000000000..be218fc9b --- /dev/null +++ b/src/test/spec/json/crud/unified/deleteOne-hint-clientError.yml @@ -0,0 +1,80 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: deleteOne-hint-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 3.3.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name DeleteOne_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'DeleteOne with hint string unsupported (client-side error)' + operations: + - + object: *collection0 + name: deleteOne + arguments: + filter: &filter + _id: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'DeleteOne with hint document unsupported (client-side error)' + operations: + - + object: *collection0 + name: deleteOne + arguments: + filter: *filter + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/deleteOne-hint-serverError.json b/src/test/spec/json/crud/unified/deleteOne-hint-serverError.json new file mode 100644 index 000000000..15541ed85 --- /dev/null +++ b/src/test/spec/json/crud/unified/deleteOne-hint-serverError.json @@ -0,0 +1,170 @@ +{ + "description": "deleteOne-hint-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.3.3" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "DeleteOne_hint" + } + } + ], + "initialData": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "DeleteOne with hint string unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "DeleteOne_hint", + "deletes": [ + { + "q": { + "_id": 1 + }, + "hint": "_id_", + "limit": 1 + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "DeleteOne with hint document unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "DeleteOne_hint", + "deletes": [ + { + "q": { + "_id": 1 + }, + "hint": { + "_id": 1 + }, + "limit": 1 + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/deleteOne-hint-serverError.yml b/src/test/spec/json/crud/unified/deleteOne-hint-serverError.yml new file mode 100644 index 000000000..6c8c0ea81 --- /dev/null +++ b/src/test/spec/json/crud/unified/deleteOne-hint-serverError.yml @@ -0,0 +1,100 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: deleteOne-hint-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 3.4.0 + maxServerVersion: 4.3.3 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name DeleteOne_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'DeleteOne with hint string unsupported (server-side error)' + operations: + - + object: *collection0 + name: deleteOne + arguments: + filter: &filter + _id: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *filter + hint: _id_ + limit: 1 + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'DeleteOne with hint document unsupported (server-side error)' + operations: + - + object: *collection0 + name: deleteOne + arguments: + filter: *filter + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *filter + hint: + _id: 1 + limit: 1 + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/deleteOne-hint.json b/src/test/spec/json/crud/unified/deleteOne-hint.json new file mode 100644 index 000000000..bcc4bc234 --- /dev/null +++ b/src/test/spec/json/crud/unified/deleteOne-hint.json @@ -0,0 +1,161 @@ +{ + "description": "deleteOne-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.3.4" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "DeleteOne_hint" + } + } + ], + "initialData": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "DeleteOne with hint string", + "operations": [ + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + }, + "expectResult": { + "deletedCount": 1 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "DeleteOne_hint", + "deletes": [ + { + "q": { + "_id": 1 + }, + "hint": "_id_", + "limit": 1 + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "deleteOne with hint document", + "operations": [ + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": { + "_id": 1 + } + }, + "expectResult": { + "deletedCount": 1 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "DeleteOne_hint", + "deletes": [ + { + "q": { + "_id": 1 + }, + "hint": { + "_id": 1 + }, + "limit": 1 + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/deleteOne-hint.yml b/src/test/spec/json/crud/unified/deleteOne-hint.yml new file mode 100644 index 000000000..f72356c99 --- /dev/null +++ b/src/test/spec/json/crud/unified/deleteOne-hint.yml @@ -0,0 +1,95 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: deleteOne-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.3.4 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name DeleteOne_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'DeleteOne with hint string' + operations: + - + object: *collection0 + name: deleteOne + arguments: + filter: &filter + _id: 1 + hint: _id_ + expectResult: &result + deletedCount: 1 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *filter + hint: _id_ + limit: 1 + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 2 + x: 22 + - + description: 'deleteOne with hint document' + operations: + - + object: *collection0 + name: deleteOne + arguments: + filter: *filter + hint: + _id: 1 + expectResult: *result + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *filter + hint: + _id: 1 + limit: 1 + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/find-allowdiskuse-clientError.json b/src/test/spec/json/crud/unified/find-allowdiskuse-clientError.json new file mode 100644 index 000000000..5bd954e79 --- /dev/null +++ b/src/test/spec/json/crud/unified/find-allowdiskuse-clientError.json @@ -0,0 +1,79 @@ +{ + "description": "find-allowdiskuse-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "maxServerVersion": "3.0.99" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_find_allowdiskuse_clienterror" + } + } + ], + "tests": [ + { + "description": "Find fails when allowDiskUse true is specified against pre 3.2 server", + "operations": [ + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": {}, + "allowDiskUse": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + }, + { + "description": "Find fails when allowDiskUse false is specified against pre 3.2 server", + "operations": [ + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": {}, + "allowDiskUse": false + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/find-allowdiskuse-clientError.yml b/src/test/spec/json/crud/unified/find-allowdiskuse-clientError.yml new file mode 100644 index 000000000..2bc26908f --- /dev/null +++ b/src/test/spec/json/crud/unified/find-allowdiskuse-clientError.yml @@ -0,0 +1,55 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: find-allowdiskuse-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 3.0.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_find_allowdiskuse_clienterror +tests: + - + description: 'Find fails when allowDiskUse true is specified against pre 3.2 server' + operations: + - + object: *collection0 + name: find + arguments: + filter: { } + allowDiskUse: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + - + description: 'Find fails when allowDiskUse false is specified against pre 3.2 server' + operations: + - + object: *collection0 + name: find + arguments: + filter: { } + allowDiskUse: false + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] diff --git a/src/test/spec/json/crud/unified/find-allowdiskuse-serverError.json b/src/test/spec/json/crud/unified/find-allowdiskuse-serverError.json new file mode 100644 index 000000000..dc58f8f0e --- /dev/null +++ b/src/test/spec/json/crud/unified/find-allowdiskuse-serverError.json @@ -0,0 +1,100 @@ +{ + "description": "find-allowdiskuse-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "3.2", + "maxServerVersion": "4.3.0" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_find_allowdiskuse_servererror" + } + } + ], + "tests": [ + { + "description": "Find fails when allowDiskUse true is specified against pre 4.4 server (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": {}, + "allowDiskUse": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "test_find_allowdiskuse_servererror", + "filter": {}, + "allowDiskUse": true + } + } + } + ] + } + ] + }, + { + "description": "Find fails when allowDiskUse false is specified against pre 4.4 server (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": {}, + "allowDiskUse": false + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "test_find_allowdiskuse_servererror", + "filter": {}, + "allowDiskUse": false + } + } + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/find-allowdiskuse-serverError.yml b/src/test/spec/json/crud/unified/find-allowdiskuse-serverError.yml new file mode 100644 index 000000000..de73d8b37 --- /dev/null +++ b/src/test/spec/json/crud/unified/find-allowdiskuse-serverError.yml @@ -0,0 +1,68 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: find-allowdiskuse-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: '3.2' + maxServerVersion: 4.3.0 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_find_allowdiskuse_servererror +tests: + - + description: 'Find fails when allowDiskUse true is specified against pre 4.4 server (server-side error)' + operations: + - + object: *collection0 + name: find + arguments: + filter: &filter { } + allowDiskUse: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + find: *collection_name + filter: *filter + allowDiskUse: true + - + description: 'Find fails when allowDiskUse false is specified against pre 4.4 server (server-side error)' + operations: + - + object: *collection0 + name: find + arguments: + filter: *filter + allowDiskUse: false + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + find: *collection_name + filter: *filter + allowDiskUse: false diff --git a/src/test/spec/json/crud/unified/find-allowdiskuse.json b/src/test/spec/json/crud/unified/find-allowdiskuse.json new file mode 100644 index 000000000..789bb7fbf --- /dev/null +++ b/src/test/spec/json/crud/unified/find-allowdiskuse.json @@ -0,0 +1,120 @@ +{ + "description": "find-allowdiskuse", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.3.1" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_find_allowdiskuse" + } + } + ], + "tests": [ + { + "description": "Find does not send allowDiskuse when value is not specified", + "operations": [ + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": {} + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "test_find_allowdiskuse", + "allowDiskUse": { + "$$exists": false + } + } + } + } + ] + } + ] + }, + { + "description": "Find sends allowDiskuse false when false is specified", + "operations": [ + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": {}, + "allowDiskUse": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "test_find_allowdiskuse", + "allowDiskUse": false + } + } + } + ] + } + ] + }, + { + "description": "Find sends allowDiskUse true when true is specified", + "operations": [ + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": {}, + "allowDiskUse": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "test_find_allowdiskuse", + "allowDiskUse": true + } + } + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/find-allowdiskuse.yml b/src/test/spec/json/crud/unified/find-allowdiskuse.yml new file mode 100644 index 000000000..b2de4037d --- /dev/null +++ b/src/test/spec/json/crud/unified/find-allowdiskuse.yml @@ -0,0 +1,79 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: find-allowdiskuse +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.3.1 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_find_allowdiskuse +tests: + - + description: 'Find does not send allowDiskuse when value is not specified' + operations: + - + object: *collection0 + name: find + arguments: + filter: { } + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + find: *collection_name + allowDiskUse: + $$exists: false + - + description: 'Find sends allowDiskuse false when false is specified' + operations: + - + object: *collection0 + name: find + arguments: + filter: { } + allowDiskUse: false + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + find: *collection_name + allowDiskUse: false + - + description: 'Find sends allowDiskUse true when true is specified' + operations: + - + object: *collection0 + name: find + arguments: + filter: { } + allowDiskUse: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + find: *collection_name + allowDiskUse: true diff --git a/src/test/spec/json/crud/unified/find.json b/src/test/spec/json/crud/unified/find.json new file mode 100644 index 000000000..275d5d351 --- /dev/null +++ b/src/test/spec/json/crud/unified/find.json @@ -0,0 +1,156 @@ +{ + "description": "find", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "find-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "find-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + }, + { + "_id": 5, + "x": 55 + }, + { + "_id": 6, + "x": 66 + } + ] + } + ], + "tests": [ + { + "description": "find with multiple batches works", + "operations": [ + { + "name": "find", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "batchSize": 2 + }, + "object": "collection0", + "expectResult": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + }, + { + "_id": 5, + "x": 55 + }, + { + "_id": 6, + "x": 66 + } + ] + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": { + "_id": { + "$gt": 1 + } + }, + "batchSize": 2 + }, + "commandName": "find", + "databaseName": "find-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "coll0", + "batchSize": 2 + }, + "commandName": "getMore", + "databaseName": "find-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "coll0", + "batchSize": 2 + }, + "commandName": "getMore", + "databaseName": "find-tests" + } + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/find.yml b/src/test/spec/json/crud/unified/find.yml new file mode 100644 index 000000000..5615f0723 --- /dev/null +++ b/src/test/spec/json/crud/unified/find.yml @@ -0,0 +1,68 @@ +description: "find" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true # ensure cursors pin to a single server + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name find-tests + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + - { _id: 4, x: 44 } + - { _id: 5, x: 55 } + - { _id: 6, x: 66 } + +tests: + - description: "find with multiple batches works" + operations: + - name: find + arguments: + filter: { _id: { $gt: 1 } } + batchSize: 2 + object: *collection0 + expectResult: + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + - { _id: 4, x: 44 } + - { _id: 5, x: 55 } + - { _id: 6, x: 66 } + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + find: *collection0Name + filter: { _id: { $gt: 1 } } + batchSize: 2 + commandName: find + databaseName: *database0Name + - commandStartedEvent: + command: + getMore: { $$type: [ int, long ] } + collection: *collection0Name + batchSize: 2 + commandName: getMore + databaseName: *database0Name + - commandStartedEvent: + command: + getMore: { $$type: [ int, long ] } + collection: *collection0Name + batchSize: 2 + commandName: getMore + databaseName: *database0Name + diff --git a/src/test/spec/json/crud/unified/findOneAndDelete-hint-clientError.json b/src/test/spec/json/crud/unified/findOneAndDelete-hint-clientError.json new file mode 100644 index 000000000..c6ff46786 --- /dev/null +++ b/src/test/spec/json/crud/unified/findOneAndDelete-hint-clientError.json @@ -0,0 +1,133 @@ +{ + "description": "findOneAndDelete-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "maxServerVersion": "4.0.99" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndDelete_hint" + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "FindOneAndDelete with hint string unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "FindOneAndDelete with hint document", + "operations": [ + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/findOneAndDelete-hint-clientError.yml b/src/test/spec/json/crud/unified/findOneAndDelete-hint-clientError.yml new file mode 100644 index 000000000..220496872 --- /dev/null +++ b/src/test/spec/json/crud/unified/findOneAndDelete-hint-clientError.yml @@ -0,0 +1,91 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndDelete-hint-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 4.0.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndDelete_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'FindOneAndDelete with hint string unsupported (client-side error)' + operations: + - + object: *collection0 + name: findOneAndDelete + arguments: + filter: &filter + _id: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'FindOneAndDelete with hint document' + operations: + - + object: *collection0 + name: findOneAndDelete + arguments: + filter: &filter + _id: 1 + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 diff --git a/src/test/spec/json/crud/unified/findOneAndDelete-hint-serverError.json b/src/test/spec/json/crud/unified/findOneAndDelete-hint-serverError.json new file mode 100644 index 000000000..b87410272 --- /dev/null +++ b/src/test/spec/json/crud/unified/findOneAndDelete-hint-serverError.json @@ -0,0 +1,162 @@ +{ + "description": "findOneAndDelete-hint-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.2.0", + "maxServerVersion": "4.3.3" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndDelete_hint" + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "FindOneAndDelete with hint string unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndDelete_hint", + "query": { + "_id": 1 + }, + "hint": "_id_", + "remove": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "FindOneAndDelete with hint document unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndDelete_hint", + "query": { + "_id": 1 + }, + "hint": { + "_id": 1 + }, + "remove": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/findOneAndDelete-hint-serverError.yml b/src/test/spec/json/crud/unified/findOneAndDelete-hint-serverError.yml new file mode 100644 index 000000000..5fd21eedc --- /dev/null +++ b/src/test/spec/json/crud/unified/findOneAndDelete-hint-serverError.yml @@ -0,0 +1,107 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndDelete-hint-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.2.0 + maxServerVersion: 4.3.3 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndDelete_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'FindOneAndDelete with hint string unsupported (server-side error)' + operations: + - + object: *collection0 + name: findOneAndDelete + arguments: + filter: &filter + _id: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + hint: _id_ + remove: true + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'FindOneAndDelete with hint document unsupported (server-side error)' + operations: + - + object: *collection0 + name: findOneAndDelete + arguments: + filter: &filter + _id: 1 + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + hint: + _id: 1 + remove: true + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 diff --git a/src/test/spec/json/crud/unified/findOneAndDelete-hint.json b/src/test/spec/json/crud/unified/findOneAndDelete-hint.json new file mode 100644 index 000000000..8b53f2bd3 --- /dev/null +++ b/src/test/spec/json/crud/unified/findOneAndDelete-hint.json @@ -0,0 +1,155 @@ +{ + "description": "findOneAndDelete-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.3.4" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndDelete_hint" + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "FindOneAndDelete with hint string", + "operations": [ + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + }, + "expectResult": { + "_id": 1, + "x": 11 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndDelete_hint", + "query": { + "_id": 1 + }, + "hint": "_id_", + "remove": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "FindOneAndDelete with hint document", + "operations": [ + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": { + "_id": 1 + } + }, + "expectResult": { + "_id": 1, + "x": 11 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndDelete_hint", + "query": { + "_id": 1 + }, + "hint": { + "_id": 1 + }, + "remove": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/findOneAndDelete-hint.yml b/src/test/spec/json/crud/unified/findOneAndDelete-hint.yml new file mode 100644 index 000000000..3dc4f3ff4 --- /dev/null +++ b/src/test/spec/json/crud/unified/findOneAndDelete-hint.yml @@ -0,0 +1,102 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndDelete-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.3.4 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndDelete_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'FindOneAndDelete with hint string' + operations: + - + object: *collection0 + name: findOneAndDelete + arguments: + filter: &filter + _id: 1 + hint: _id_ + expectResult: &result + _id: 1 + x: 11 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + hint: _id_ + remove: true + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 2 + x: 22 + - + description: 'FindOneAndDelete with hint document' + operations: + - + object: *collection0 + name: findOneAndDelete + arguments: + filter: &filter + _id: 1 + hint: + _id: 1 + expectResult: &result + _id: 1 + x: 11 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + hint: + _id: 1 + remove: true + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 2 + x: 22 diff --git a/src/test/spec/json/crud/unified/findOneAndReplace-hint-clientError.json b/src/test/spec/json/crud/unified/findOneAndReplace-hint-clientError.json new file mode 100644 index 000000000..6b07eb1f4 --- /dev/null +++ b/src/test/spec/json/crud/unified/findOneAndReplace-hint-clientError.json @@ -0,0 +1,139 @@ +{ + "description": "findOneAndReplace-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "maxServerVersion": "4.0.99" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndReplace_hint" + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "FindOneAndReplace with hint string unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "x": 33 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "findOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "FindOneAndReplace with hint document unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "x": 33 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "findOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/findOneAndReplace-hint-clientError.yml b/src/test/spec/json/crud/unified/findOneAndReplace-hint-clientError.yml new file mode 100644 index 000000000..f59952ffc --- /dev/null +++ b/src/test/spec/json/crud/unified/findOneAndReplace-hint-clientError.yml @@ -0,0 +1,83 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndReplace-hint-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 4.0.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndReplace_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'FindOneAndReplace with hint string unsupported (client-side error)' + operations: + - + object: *collection0 + name: findOneAndReplace + arguments: + filter: &filter + _id: 1 + replacement: &replacement + x: 33 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'FindOneAndReplace with hint document unsupported (client-side error)' + operations: + - + object: *collection0 + name: findOneAndReplace + arguments: + filter: *filter + replacement: *replacement + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/findOneAndReplace-hint-serverError.json b/src/test/spec/json/crud/unified/findOneAndReplace-hint-serverError.json new file mode 100644 index 000000000..7fbf5a0ea --- /dev/null +++ b/src/test/spec/json/crud/unified/findOneAndReplace-hint-serverError.json @@ -0,0 +1,172 @@ +{ + "description": "findOneAndReplace-hint-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.2.0", + "maxServerVersion": "4.3.0" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndReplace_hint" + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "FindOneAndReplace with hint string unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "x": 33 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndReplace_hint", + "query": { + "_id": 1 + }, + "update": { + "x": 33 + }, + "hint": "_id_" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "FindOneAndReplace with hint document unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "x": 33 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndReplace_hint", + "query": { + "_id": 1 + }, + "update": { + "x": 33 + }, + "hint": { + "_id": 1 + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/findOneAndReplace-hint-serverError.yml b/src/test/spec/json/crud/unified/findOneAndReplace-hint-serverError.yml new file mode 100644 index 000000000..664cd0bbc --- /dev/null +++ b/src/test/spec/json/crud/unified/findOneAndReplace-hint-serverError.yml @@ -0,0 +1,99 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndReplace-hint-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.2.0 + maxServerVersion: 4.3.0 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndReplace_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'FindOneAndReplace with hint string unsupported (server-side error)' + operations: + - + object: *collection0 + name: findOneAndReplace + arguments: + filter: &filter + _id: 1 + replacement: &replacement + x: 33 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + update: *replacement + hint: _id_ + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'FindOneAndReplace with hint document unsupported (server-side error)' + operations: + - + object: *collection0 + name: findOneAndReplace + arguments: + filter: *filter + replacement: *replacement + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + update: *replacement + hint: + _id: 1 + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/findOneAndReplace-hint.json b/src/test/spec/json/crud/unified/findOneAndReplace-hint.json new file mode 100644 index 000000000..d07c5921a --- /dev/null +++ b/src/test/spec/json/crud/unified/findOneAndReplace-hint.json @@ -0,0 +1,173 @@ +{ + "description": "findOneAndReplace-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.3.1" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndReplace_hint" + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "FindOneAndReplace with hint string", + "operations": [ + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "x": 33 + }, + "hint": "_id_" + }, + "expectResult": { + "_id": 1, + "x": 11 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndReplace_hint", + "query": { + "_id": 1 + }, + "update": { + "x": 33 + }, + "hint": "_id_" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 33 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "FindOneAndReplace with hint document", + "operations": [ + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "x": 33 + }, + "hint": { + "_id": 1 + } + }, + "expectResult": { + "_id": 1, + "x": 11 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndReplace_hint", + "query": { + "_id": 1 + }, + "update": { + "x": 33 + }, + "hint": { + "_id": 1 + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 33 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/findOneAndReplace-hint.yml b/src/test/spec/json/crud/unified/findOneAndReplace-hint.yml new file mode 100644 index 000000000..9c581270a --- /dev/null +++ b/src/test/spec/json/crud/unified/findOneAndReplace-hint.yml @@ -0,0 +1,98 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndReplace-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.3.1 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndReplace_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'FindOneAndReplace with hint string' + operations: + - + object: *collection0 + name: findOneAndReplace + arguments: + filter: &filter + _id: 1 + replacement: &replacement + x: 33 + hint: _id_ + expectResult: &result + _id: 1 + x: 11 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + update: *replacement + hint: _id_ + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 33 + - + _id: 2 + x: 22 + - + description: 'FindOneAndReplace with hint document' + operations: + - + object: *collection0 + name: findOneAndReplace + arguments: + filter: *filter + replacement: *replacement + hint: + _id: 1 + expectResult: *result + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + update: *replacement + hint: + _id: 1 + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/findOneAndUpdate-hint-clientError.json b/src/test/spec/json/crud/unified/findOneAndUpdate-hint-clientError.json new file mode 100644 index 000000000..d0b51313c --- /dev/null +++ b/src/test/spec/json/crud/unified/findOneAndUpdate-hint-clientError.json @@ -0,0 +1,143 @@ +{ + "description": "findOneAndUpdate-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "maxServerVersion": "4.0.99" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndUpdate_hint" + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "FindOneAndUpdate with hint string unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "findOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "FindOneAndUpdate with hint document unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "findOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/findOneAndUpdate-hint-clientError.yml b/src/test/spec/json/crud/unified/findOneAndUpdate-hint-clientError.yml new file mode 100644 index 000000000..5ad4f07cc --- /dev/null +++ b/src/test/spec/json/crud/unified/findOneAndUpdate-hint-clientError.yml @@ -0,0 +1,84 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndUpdate-hint-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 4.0.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndUpdate_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'FindOneAndUpdate with hint string unsupported (client-side error)' + operations: + - + object: *collection0 + name: findOneAndUpdate + arguments: + filter: &filter + _id: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'FindOneAndUpdate with hint document unsupported (client-side error)' + operations: + - + object: *collection0 + name: findOneAndUpdate + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/findOneAndUpdate-hint-serverError.json b/src/test/spec/json/crud/unified/findOneAndUpdate-hint-serverError.json new file mode 100644 index 000000000..99fd9938f --- /dev/null +++ b/src/test/spec/json/crud/unified/findOneAndUpdate-hint-serverError.json @@ -0,0 +1,180 @@ +{ + "description": "findOneAndUpdate-hint-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.2.0", + "maxServerVersion": "4.3.0" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndUpdate_hint" + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "FindOneAndUpdate with hint string unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndUpdate_hint", + "query": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "FindOneAndUpdate with hint document unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndUpdate_hint", + "query": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/findOneAndUpdate-hint-serverError.yml b/src/test/spec/json/crud/unified/findOneAndUpdate-hint-serverError.yml new file mode 100644 index 000000000..f6b4f8d62 --- /dev/null +++ b/src/test/spec/json/crud/unified/findOneAndUpdate-hint-serverError.yml @@ -0,0 +1,100 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndUpdate-hint-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.2.0 + maxServerVersion: 4.3.0 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndUpdate_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'FindOneAndUpdate with hint string unsupported (server-side error)' + operations: + - + object: *collection0 + name: findOneAndUpdate + arguments: + filter: &filter + _id: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + update: *update + hint: _id_ + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'FindOneAndUpdate with hint document unsupported (server-side error)' + operations: + - + object: *collection0 + name: findOneAndUpdate + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + update: *update + hint: + _id: 1 + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/findOneAndUpdate-hint.json b/src/test/spec/json/crud/unified/findOneAndUpdate-hint.json new file mode 100644 index 000000000..5be6d2b3e --- /dev/null +++ b/src/test/spec/json/crud/unified/findOneAndUpdate-hint.json @@ -0,0 +1,181 @@ +{ + "description": "findOneAndUpdate-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.3.1" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndUpdate_hint" + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "FindOneAndUpdate with hint string", + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectResult": { + "_id": 1, + "x": 11 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndUpdate_hint", + "query": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 12 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "FindOneAndUpdate with hint document", + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectResult": { + "_id": 1, + "x": 11 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndUpdate_hint", + "query": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 12 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/findOneAndUpdate-hint.yml b/src/test/spec/json/crud/unified/findOneAndUpdate-hint.yml new file mode 100644 index 000000000..5e835faa9 --- /dev/null +++ b/src/test/spec/json/crud/unified/findOneAndUpdate-hint.yml @@ -0,0 +1,99 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndUpdate-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.3.1 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndUpdate_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'FindOneAndUpdate with hint string' + operations: + - + object: *collection0 + name: findOneAndUpdate + arguments: + filter: &filter + _id: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectResult: &result + _id: 1 + x: 11 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + update: *update + hint: _id_ + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 12 + - + _id: 2 + x: 22 + - + description: 'FindOneAndUpdate with hint document' + operations: + - + object: *collection0 + name: findOneAndUpdate + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectResult: *result + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + update: *update + hint: + _id: 1 + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/replaceOne-hint.json b/src/test/spec/json/crud/unified/replaceOne-hint.json new file mode 100644 index 000000000..6926e9d8d --- /dev/null +++ b/src/test/spec/json/crud/unified/replaceOne-hint.json @@ -0,0 +1,203 @@ +{ + "description": "replaceOne-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.2.0" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_replaceone_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_replaceone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "ReplaceOne with hint string", + "operations": [ + { + "object": "collection0", + "name": "replaceOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "replacement": { + "x": 111 + }, + "hint": "_id_" + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_replaceone_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "x": 111 + }, + "hint": "_id_", + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_replaceone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 111 + } + ] + } + ] + }, + { + "description": "ReplaceOne with hint document", + "operations": [ + { + "object": "collection0", + "name": "replaceOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "replacement": { + "x": 111 + }, + "hint": { + "_id": 1 + } + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_replaceone_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "x": 111 + }, + "hint": { + "_id": 1 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_replaceone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 111 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/replaceOne-hint.yml b/src/test/spec/json/crud/unified/replaceOne-hint.yml new file mode 100644 index 000000000..d00bf6744 --- /dev/null +++ b/src/test/spec/json/crud/unified/replaceOne-hint.yml @@ -0,0 +1,112 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: replaceOne-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.2.0 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_replaceone_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'ReplaceOne with hint string' + operations: + - + object: *collection0 + name: replaceOne + arguments: + filter: &filter + _id: + $gt: 1 + replacement: &replacement + x: 111 + hint: _id_ + expectResult: &result + matchedCount: 1 + modifiedCount: 1 + upsertedCount: 0 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *replacement + hint: _id_ + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 111 + - + description: 'ReplaceOne with hint document' + operations: + - + object: *collection0 + name: replaceOne + arguments: + filter: *filter + replacement: *replacement + hint: + _id: 1 + expectResult: *result + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *replacement + hint: + _id: 1 + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.json b/src/test/spec/json/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.json new file mode 100644 index 000000000..dbaa2e84f --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.json @@ -0,0 +1,193 @@ +{ + "description": "unacknowledged-bulkWrite-delete-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "BulkWrite_delete_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ], + "tests": [ + { + "description": "Unacknowledged bulkWrite deleteOne with hints fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "deleteOne": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + } + }, + { + "deleteOne": { + "filter": { + "_id": 2 + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_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", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "deleteMany": { + "filter": { + "_id": { + "$lt": 3 + } + }, + "hint": "_id_" + } + }, + { + "deleteMany": { + "filter": { + "_id": { + "$gte": 4 + } + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.yml b/src/test/spec/json/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.yml new file mode 100644 index 000000000..3aaa18243 --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.yml @@ -0,0 +1,112 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-bulkWrite-delete-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name BulkWrite_delete_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 +tests: + - + description: 'Unacknowledged bulkWrite deleteOne with hints fails with client-side error' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + deleteOne: + filter: &deleteOne_filter1 + _id: 1 + hint: &hint_string _id_ + - + deleteOne: + filter: &deleteOne_filter2 + _id: 2 + hint: &hint_doc + _id: 1 + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _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' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + deleteMany: + filter: &deleteMany_filter1 + _id: + $lt: 3 + hint: *hint_string + - + deleteMany: + filter: &deleteMany_filter2 + _id: + $gte: 4 + hint: *hint_doc + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.json b/src/test/spec/json/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.json new file mode 100644 index 000000000..858967b90 --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.json @@ -0,0 +1,284 @@ +{ + "description": "unacknowledged-bulkWrite-update-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "Bulkwrite_update_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ + { + "collectionName": "Bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ], + "tests": [ + { + "description": "Unacknowledged bulkWrite updateOne with hints fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateOne": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + } + }, + { + "updateOne": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "Bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_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", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateMany": { + "filter": { + "_id": { + "$lt": 3 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + } + }, + { + "updateMany": { + "filter": { + "_id": { + "$lt": 3 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "Bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + }, + { + "description": "Unacknowledged bulkWrite replaceOne with hints fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "replaceOne": { + "filter": { + "_id": 3 + }, + "replacement": { + "x": 333 + }, + "hint": "_id_" + } + }, + { + "replaceOne": { + "filter": { + "_id": 4 + }, + "replacement": { + "x": 444 + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "Bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.yml b/src/test/spec/json/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.yml new file mode 100644 index 000000000..95620f097 --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.yml @@ -0,0 +1,147 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-bulkWrite-update-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name Bulkwrite_update_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 +tests: + - + description: 'Unacknowledged bulkWrite updateOne with hints fails with client-side error' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateOne: + filter: &updateOne_filter + _id: 1 + update: &updateOne_update + $inc: + x: 1 + hint: &hint_string _id_ + - + updateOne: + filter: *updateOne_filter + update: *updateOne_update + hint: &hint_doc + _id: 1 + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _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' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateMany: + filter: &updateMany_filter + _id: + $lt: 3 + update: &updateMany_update + $inc: + x: 1 + hint: *hint_string + - + updateMany: + filter: *updateMany_filter + update: *updateMany_update + hint: *hint_doc + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome + - + description: 'Unacknowledged bulkWrite replaceOne with hints fails with client-side error' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + replaceOne: + filter: + _id: 3 + replacement: + x: 333 + hint: *hint_string + - + replaceOne: + filter: + _id: 4 + replacement: + x: 444 + hint: *hint_doc + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/unacknowledged-deleteMany-hint-clientError.json b/src/test/spec/json/crud/unified/unacknowledged-deleteMany-hint-clientError.json new file mode 100644 index 000000000..c5d9f6af3 --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-deleteMany-hint-clientError.json @@ -0,0 +1,149 @@ +{ + "description": "unacknowledged-deleteMany-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "DeleteMany_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "Unacknowledged deleteMany with hint string fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "Unacknowledged deleteMany with hint document fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/unacknowledged-deleteMany-hint-clientError.yml b/src/test/spec/json/crud/unified/unacknowledged-deleteMany-hint-clientError.yml new file mode 100644 index 000000000..7acbbc7ca --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-deleteMany-hint-clientError.yml @@ -0,0 +1,86 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-deleteMany-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name DeleteMany_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'Unacknowledged deleteMany with hint string fails with client-side error' + operations: + - + object: *collection0 + name: deleteMany + arguments: + filter: &filter + _id: + $gt: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + description: 'Unacknowledged deleteMany with hint document fails with client-side error' + operations: + - + object: *collection0 + name: deleteMany + arguments: + filter: *filter + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/unacknowledged-deleteOne-hint-clientError.json b/src/test/spec/json/crud/unified/unacknowledged-deleteOne-hint-clientError.json new file mode 100644 index 000000000..177ad889b --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-deleteOne-hint-clientError.json @@ -0,0 +1,133 @@ +{ + "description": "unacknowledged-deleteOne-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "DeleteOne_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "Unacknowledged deleteOne with hint string fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "Unacknowledged deleteOne with hint document fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/unacknowledged-deleteOne-hint-clientError.yml b/src/test/spec/json/crud/unified/unacknowledged-deleteOne-hint-clientError.yml new file mode 100644 index 000000000..996dad6ca --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-deleteOne-hint-clientError.yml @@ -0,0 +1,79 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-deleteOne-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name DeleteOne_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'Unacknowledged deleteOne with hint string fails with client-side error' + operations: + - + object: *collection0 + name: deleteOne + arguments: + filter: &filter + _id: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'Unacknowledged deleteOne with hint document fails with client-side error' + operations: + - + object: *collection0 + name: deleteOne + arguments: + filter: *filter + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.json b/src/test/spec/json/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.json new file mode 100644 index 000000000..6ee59cdf6 --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.json @@ -0,0 +1,133 @@ +{ + "description": "unacknowledged-findOneAndDelete-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndDelete_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "Unacknowledged findOneAndDelete with hint string fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "Unacknowledged findOneAndDelete with hint document fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.yml b/src/test/spec/json/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.yml new file mode 100644 index 000000000..7a619d30a --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.yml @@ -0,0 +1,90 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-findOneAndDelete-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndDelete_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'Unacknowledged findOneAndDelete with hint string fails with client-side error' + operations: + - + object: *collection0 + name: findOneAndDelete + arguments: + filter: &filter + _id: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'Unacknowledged findOneAndDelete with hint document fails with client-side error' + operations: + - + object: *collection0 + name: findOneAndDelete + arguments: + filter: &filter + _id: 1 + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 diff --git a/src/test/spec/json/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.json b/src/test/spec/json/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.json new file mode 100644 index 000000000..15ca77322 --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.json @@ -0,0 +1,139 @@ +{ + "description": "unacknowledged-findOneAndReplace-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "FindOneAndReplace_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ + { + "collectionName": "FindOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "Unacknowledged findOneAndReplace with hint string fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "x": 33 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "FindOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "Unacknowledged findOneAndReplace with hint document fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "x": 33 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "FindOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.yml b/src/test/spec/json/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.yml new file mode 100644 index 000000000..cbd12dac9 --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.yml @@ -0,0 +1,82 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-findOneAndReplace-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name FindOneAndReplace_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'Unacknowledged findOneAndReplace with hint string fails with client-side error' + operations: + - + object: *collection0 + name: findOneAndReplace + arguments: + filter: &filter + _id: 1 + replacement: &replacement + x: 33 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'Unacknowledged findOneAndReplace with hint document fails with client-side error' + operations: + - + object: *collection0 + name: findOneAndReplace + arguments: + filter: *filter + replacement: *replacement + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.json b/src/test/spec/json/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.json new file mode 100644 index 000000000..e18767f8b --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.json @@ -0,0 +1,143 @@ +{ + "description": "unacknowledged-findOneAndUpdate-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "FindOneAndUpdate_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ + { + "collectionName": "FindOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "Unacknowledged findOneAndUpdate with hint string fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "FindOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "Unacknowledged findOneAndUpdate with hint document fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "FindOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.yml b/src/test/spec/json/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.yml new file mode 100644 index 000000000..b9cd0229c --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.yml @@ -0,0 +1,83 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-findOneAndUpdate-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name FindOneAndUpdate_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'Unacknowledged findOneAndUpdate with hint string fails with client-side error' + operations: + - + object: *collection0 + name: findOneAndUpdate + arguments: + filter: &filter + _id: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'Unacknowledged findOneAndUpdate with hint document fails with client-side error' + operations: + - + object: *collection0 + name: findOneAndUpdate + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/unacknowledged-replaceOne-hint-clientError.json b/src/test/spec/json/crud/unified/unacknowledged-replaceOne-hint-clientError.json new file mode 100644 index 000000000..52ec59d0c --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-replaceOne-hint-clientError.json @@ -0,0 +1,143 @@ +{ + "description": "unacknowledged-replaceOne-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "ReplaceOne_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ + { + "collectionName": "ReplaceOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "Unacknowledged ReplaceOne with hint string fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "replaceOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "replacement": { + "x": 111 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "ReplaceOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "Unacknowledged ReplaceOne with hint document fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "replaceOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "replacement": { + "x": 111 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "ReplaceOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/unacknowledged-replaceOne-hint-clientError.yml b/src/test/spec/json/crud/unified/unacknowledged-replaceOne-hint-clientError.yml new file mode 100644 index 000000000..710cd424b --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-replaceOne-hint-clientError.yml @@ -0,0 +1,83 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-replaceOne-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name ReplaceOne_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'Unacknowledged ReplaceOne with hint string fails with client-side error' + operations: + - + object: *collection0 + name: replaceOne + arguments: + filter: &filter + _id: + $gt: 1 + replacement: &replacement + x: 111 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'Unacknowledged ReplaceOne with hint document fails with client-side error' + operations: + - + object: *collection0 + name: replaceOne + arguments: + filter: *filter + replacement: *replacement + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/unacknowledged-updateMany-hint-clientError.json b/src/test/spec/json/crud/unified/unacknowledged-updateMany-hint-clientError.json new file mode 100644 index 000000000..6199dfa2b --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-updateMany-hint-clientError.json @@ -0,0 +1,159 @@ +{ + "description": "unacknowledged-updateMany-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "Updatemany_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ + { + "collectionName": "Updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "Unacknowledged updateMany with hint string fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "updateMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "Updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "Unacknowledged updateMany with hint document fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "updateMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "Updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/unacknowledged-updateMany-hint-clientError.yml b/src/test/spec/json/crud/unified/unacknowledged-updateMany-hint-clientError.yml new file mode 100644 index 000000000..1594c7cd4 --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-updateMany-hint-clientError.yml @@ -0,0 +1,90 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-updateMany-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name Updatemany_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'Unacknowledged updateMany with hint string fails with client-side error' + operations: + - + object: *collection0 + name: updateMany + arguments: + filter: &filter + _id: + $gt: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + description: 'Unacknowledged updateMany with hint document fails with client-side error' + operations: + - + object: *collection0 + name: updateMany + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/unacknowledged-updateOne-hint-clientError.json b/src/test/spec/json/crud/unified/unacknowledged-updateOne-hint-clientError.json new file mode 100644 index 000000000..3828a9e8d --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-updateOne-hint-clientError.json @@ -0,0 +1,147 @@ +{ + "description": "unacknowledged-updateOne-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "UpdateOne_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ + { + "collectionName": "UpdateOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "Unacknowledged updateOne with hint string fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "UpdateOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "Unacknowledged updateOne with hint document fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "UpdateOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/unacknowledged-updateOne-hint-clientError.yml b/src/test/spec/json/crud/unified/unacknowledged-updateOne-hint-clientError.yml new file mode 100644 index 000000000..49126ea00 --- /dev/null +++ b/src/test/spec/json/crud/unified/unacknowledged-updateOne-hint-clientError.yml @@ -0,0 +1,84 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-updateOne-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name UpdateOne_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'Unacknowledged updateOne with hint string fails with client-side error' + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: &filter + _id: + $gt: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'Unacknowledged updateOne with hint document fails with client-side error' + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/updateMany-hint-clientError.json b/src/test/spec/json/crud/unified/updateMany-hint-clientError.json new file mode 100644 index 000000000..5da878e29 --- /dev/null +++ b/src/test/spec/json/crud/unified/updateMany-hint-clientError.json @@ -0,0 +1,159 @@ +{ + "description": "updateMany-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "maxServerVersion": "3.3.99" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_updatemany_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "UpdateMany with hint string unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "updateMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "UpdateMany with hint document unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "updateMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/updateMany-hint-clientError.yml b/src/test/spec/json/crud/unified/updateMany-hint-clientError.yml new file mode 100644 index 000000000..9734078ce --- /dev/null +++ b/src/test/spec/json/crud/unified/updateMany-hint-clientError.yml @@ -0,0 +1,91 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: updateMany-hint-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 3.3.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_updatemany_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'UpdateMany with hint string unsupported (client-side error)' + operations: + - + object: *collection0 + name: updateMany + arguments: + filter: &filter + _id: + $gt: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + description: 'UpdateMany with hint document unsupported (client-side error)' + operations: + - + object: *collection0 + name: updateMany + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/updateMany-hint-serverError.json b/src/test/spec/json/crud/unified/updateMany-hint-serverError.json new file mode 100644 index 000000000..c81f36b13 --- /dev/null +++ b/src/test/spec/json/crud/unified/updateMany-hint-serverError.json @@ -0,0 +1,216 @@ +{ + "description": "updateMany-hint-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.1.9" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_updatemany_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "UpdateMany with hint string unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "updateMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_updatemany_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": true, + "hint": "_id_", + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "UpdateMany with hint document unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "updateMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_updatemany_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": true, + "hint": { + "_id": 1 + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/updateMany-hint-serverError.yml b/src/test/spec/json/crud/unified/updateMany-hint-serverError.yml new file mode 100644 index 000000000..9e392c266 --- /dev/null +++ b/src/test/spec/json/crud/unified/updateMany-hint-serverError.yml @@ -0,0 +1,117 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: updateMany-hint-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 3.4.0 + maxServerVersion: 4.1.9 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_updatemany_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'UpdateMany with hint string unsupported (server-side error)' + operations: + - + object: *collection0 + name: updateMany + arguments: + filter: &filter + _id: + $gt: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *update + multi: true + hint: _id_ + upsert: + $$unsetOrMatches: false + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + description: 'UpdateMany with hint document unsupported (server-side error)' + operations: + - + object: *collection0 + name: updateMany + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *update + multi: true + hint: + _id: 1 + upsert: + $$unsetOrMatches: false + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/updateMany-hint.json b/src/test/spec/json/crud/unified/updateMany-hint.json new file mode 100644 index 000000000..929be5299 --- /dev/null +++ b/src/test/spec/json/crud/unified/updateMany-hint.json @@ -0,0 +1,219 @@ +{ + "description": "updateMany-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.2.0" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_updatemany_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "UpdateMany with hint string", + "operations": [ + { + "object": "collection0", + "name": "updateMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectResult": { + "matchedCount": 2, + "modifiedCount": 2, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_updatemany_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": true, + "hint": "_id_", + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 23 + }, + { + "_id": 3, + "x": 34 + } + ] + } + ] + }, + { + "description": "UpdateMany with hint document", + "operations": [ + { + "object": "collection0", + "name": "updateMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectResult": { + "matchedCount": 2, + "modifiedCount": 2, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_updatemany_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": true, + "hint": { + "_id": 1 + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 23 + }, + { + "_id": 3, + "x": 34 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/updateMany-hint.yml b/src/test/spec/json/crud/unified/updateMany-hint.yml new file mode 100644 index 000000000..7ddb3a7b1 --- /dev/null +++ b/src/test/spec/json/crud/unified/updateMany-hint.yml @@ -0,0 +1,117 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: updateMany-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.2.0 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_updatemany_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'UpdateMany with hint string' + operations: + - + object: *collection0 + name: updateMany + arguments: + filter: &filter + _id: + $gt: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectResult: &result + matchedCount: 2 + modifiedCount: 2 + upsertedCount: 0 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *update + multi: true + hint: _id_ + upsert: + $$unsetOrMatches: false + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 23 + - + _id: 3 + x: 34 + - + description: 'UpdateMany with hint document' + operations: + - + object: *collection0 + name: updateMany + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectResult: *result + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *update + multi: true + hint: + _id: 1 + upsert: + $$unsetOrMatches: false + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/updateOne-hint-clientError.json b/src/test/spec/json/crud/unified/updateOne-hint-clientError.json new file mode 100644 index 000000000..d4f1a5343 --- /dev/null +++ b/src/test/spec/json/crud/unified/updateOne-hint-clientError.json @@ -0,0 +1,147 @@ +{ + "description": "updateOne-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "maxServerVersion": "3.3.99" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_updateone_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_updateone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "UpdateOne with hint string unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test_updateone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "UpdateOne with hint document unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test_updateone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/updateOne-hint-clientError.yml b/src/test/spec/json/crud/unified/updateOne-hint-clientError.yml new file mode 100644 index 000000000..87b4444c3 --- /dev/null +++ b/src/test/spec/json/crud/unified/updateOne-hint-clientError.yml @@ -0,0 +1,85 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: updateOne-hint-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 3.3.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_updateone_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'UpdateOne with hint string unsupported (client-side error)' + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: &filter + _id: + $gt: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'UpdateOne with hint document unsupported (client-side error)' + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/updateOne-hint-serverError.json b/src/test/spec/json/crud/unified/updateOne-hint-serverError.json new file mode 100644 index 000000000..05fb03331 --- /dev/null +++ b/src/test/spec/json/crud/unified/updateOne-hint-serverError.json @@ -0,0 +1,208 @@ +{ + "description": "updateOne-hint-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.1.9" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_updateone_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_updateone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "UpdateOne with hint string unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_updateone_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_", + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_updateone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "UpdateOne with hint document unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_updateone_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_updateone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/updateOne-hint-serverError.yml b/src/test/spec/json/crud/unified/updateOne-hint-serverError.yml new file mode 100644 index 000000000..f95c2b321 --- /dev/null +++ b/src/test/spec/json/crud/unified/updateOne-hint-serverError.yml @@ -0,0 +1,113 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: updateOne-hint-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 3.4.0 + maxServerVersion: 4.1.9 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_updateone_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'UpdateOne with hint string unsupported (server-side error)' + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: &filter + _id: + $gt: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *update + hint: _id_ + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'UpdateOne with hint document unsupported (server-side error)' + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *update + hint: + _id: 1 + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/updateOne-hint.json b/src/test/spec/json/crud/unified/updateOne-hint.json new file mode 100644 index 000000000..484e00757 --- /dev/null +++ b/src/test/spec/json/crud/unified/updateOne-hint.json @@ -0,0 +1,211 @@ +{ + "description": "updateOne-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.2.0" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_updateone_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_updateone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "UpdateOne with hint string", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_updateone_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_", + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_updateone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 23 + } + ] + } + ] + }, + { + "description": "UpdateOne with hint document", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_updateone_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_updateone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 23 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/updateOne-hint.yml b/src/test/spec/json/crud/unified/updateOne-hint.yml new file mode 100644 index 000000000..55193582f --- /dev/null +++ b/src/test/spec/json/crud/unified/updateOne-hint.yml @@ -0,0 +1,113 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: updateOne-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.2.0 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_updateone_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'UpdateOne with hint string' + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: &filter + _id: + $gt: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectResult: &result + matchedCount: 1 + modifiedCount: 1 + upsertedCount: 0 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *update + hint: _id_ + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 23 + - + description: 'UpdateOne with hint document' + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectResult: *result + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *update + hint: + _id: 1 + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + outcome: *outcome diff --git a/src/test/spec/json/crud/unified/updateWithPipelines.json b/src/test/spec/json/crud/unified/updateWithPipelines.json new file mode 100644 index 000000000..164f2f6a1 --- /dev/null +++ b/src/test/spec/json/crud/unified/updateWithPipelines.json @@ -0,0 +1,494 @@ +{ + "description": "updateWithPipelines", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.1.11" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 1, + "y": 1, + "t": { + "u": { + "v": 1 + } + } + }, + { + "_id": 2, + "x": 2, + "y": 1 + } + ] + } + ], + "tests": [ + { + "description": "UpdateOne using pipelines", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": 1 + }, + "update": [ + { + "$replaceRoot": { + "newRoot": "$t" + } + }, + { + "$addFields": { + "foo": 1 + } + } + ] + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": { + "_id": 1 + }, + "u": [ + { + "$replaceRoot": { + "newRoot": "$t" + } + }, + { + "$addFields": { + "foo": 1 + } + } + ], + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + }, + "commandName": "update", + "databaseName": "crud-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "u": { + "v": 1 + }, + "foo": 1 + }, + { + "_id": 2, + "x": 2, + "y": 1 + } + ] + } + ] + }, + { + "description": "UpdateMany using pipelines", + "operations": [ + { + "object": "collection0", + "name": "updateMany", + "arguments": { + "filter": {}, + "update": [ + { + "$project": { + "x": 1 + } + }, + { + "$addFields": { + "foo": 1 + } + } + ] + }, + "expectResult": { + "matchedCount": 2, + "modifiedCount": 2, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": {}, + "u": [ + { + "$project": { + "x": 1 + } + }, + { + "$addFields": { + "foo": 1 + } + } + ], + "multi": true, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + }, + "commandName": "update", + "databaseName": "crud-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 1, + "foo": 1 + }, + { + "_id": 2, + "x": 2, + "foo": 1 + } + ] + } + ] + }, + { + "description": "FindOneAndUpdate using pipelines", + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": 1 + }, + "update": [ + { + "$project": { + "x": 1 + } + }, + { + "$addFields": { + "foo": 1 + } + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "test", + "update": [ + { + "$project": { + "x": 1 + } + }, + { + "$addFields": { + "foo": 1 + } + } + ] + }, + "commandName": "findAndModify", + "databaseName": "crud-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 1, + "foo": 1 + }, + { + "_id": 2, + "x": 2, + "y": 1 + } + ] + } + ] + }, + { + "description": "UpdateOne in bulk write using pipelines", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateOne": { + "filter": { + "_id": 1 + }, + "update": [ + { + "$replaceRoot": { + "newRoot": "$t" + } + }, + { + "$addFields": { + "foo": 1 + } + } + ] + } + } + ] + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": { + "_id": 1 + }, + "u": [ + { + "$replaceRoot": { + "newRoot": "$t" + } + }, + { + "$addFields": { + "foo": 1 + } + } + ], + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + }, + "commandName": "update", + "databaseName": "crud-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "u": { + "v": 1 + }, + "foo": 1 + }, + { + "_id": 2, + "x": 2, + "y": 1 + } + ] + } + ] + }, + { + "description": "UpdateMany in bulk write using pipelines", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateMany": { + "filter": {}, + "update": [ + { + "$project": { + "x": 1 + } + }, + { + "$addFields": { + "foo": 1 + } + } + ] + } + } + ] + }, + "expectResult": { + "matchedCount": 2, + "modifiedCount": 2, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": {}, + "u": [ + { + "$project": { + "x": 1 + } + }, + { + "$addFields": { + "foo": 1 + } + } + ], + "multi": true, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + }, + "commandName": "update", + "databaseName": "crud-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 1, + "foo": 1 + }, + { + "_id": 2, + "x": 2, + "foo": 1 + } + ] + } + ] + } + ] +} diff --git a/src/test/spec/json/crud/unified/updateWithPipelines.yml b/src/test/spec/json/crud/unified/updateWithPipelines.yml new file mode 100644 index 000000000..4984dba24 --- /dev/null +++ b/src/test/spec/json/crud/unified/updateWithPipelines.yml @@ -0,0 +1,305 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: updateWithPipelines +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.1.11 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-tests + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 1 + 'y': 1 + t: + u: + v: 1 + - + _id: 2 + x: 2 + 'y': 1 +tests: + - + description: 'UpdateOne using pipelines' + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: + _id: 1 + update: + - + $replaceRoot: + newRoot: $t + - + $addFields: + foo: 1 + expectResult: + matchedCount: 1 + modifiedCount: 1 + upsertedCount: 0 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: 1 + u: + - { $replaceRoot: { newRoot: $t } } + - { $addFields: { foo: 1 } } + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + commandName: update + databaseName: *database_name + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + u: + v: 1 + foo: 1 + - + _id: 2 + x: 2 + 'y': 1 + - + description: 'UpdateMany using pipelines' + operations: + - + object: *collection0 + name: updateMany + arguments: + filter: { } + update: + - + $project: + x: 1 + - + $addFields: + foo: 1 + expectResult: + matchedCount: 2 + modifiedCount: 2 + upsertedCount: 0 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: { } + u: + - { $project: { x: 1 } } + - { $addFields: { foo: 1 } } + multi: true + upsert: + $$unsetOrMatches: false + commandName: update + databaseName: *database_name + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 1 + foo: 1 + - + _id: 2 + x: 2 + foo: 1 + - + description: 'FindOneAndUpdate using pipelines' + operations: + - + object: *collection0 + name: findOneAndUpdate + arguments: + filter: + _id: 1 + update: + - + $project: + x: 1 + - + $addFields: + foo: 1 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + update: + - + $project: + x: 1 + - + $addFields: + foo: 1 + commandName: findAndModify + databaseName: *database_name + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 1 + foo: 1 + - + _id: 2 + x: 2 + 'y': 1 + - + description: 'UpdateOne in bulk write using pipelines' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateOne: + filter: + _id: 1 + update: + - + $replaceRoot: + newRoot: $t + - + $addFields: + foo: 1 + expectResult: + matchedCount: 1 + modifiedCount: 1 + upsertedCount: 0 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: 1 + u: + - { $replaceRoot: { newRoot: $t } } + - { $addFields: { foo: 1 } } + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + commandName: update + databaseName: *database_name + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + u: + v: 1 + foo: 1 + - + _id: 2 + x: 2 + 'y': 1 + - + description: 'UpdateMany in bulk write using pipelines' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateMany: + filter: { } + update: + - + $project: + x: 1 + - + $addFields: + foo: 1 + expectResult: + matchedCount: 2 + modifiedCount: 2 + upsertedCount: 0 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: { } + u: + - { $project: { x: 1 } } + - { $addFields: { foo: 1 } } + multi: true + upsert: + $$unsetOrMatches: false + commandName: update + databaseName: *database_name + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 1 + foo: 1 + - + _id: 2 + x: 2 + foo: 1