diff --git a/src/collection.ts b/src/collection.ts index efd5d8db66..3b83e81f44 100644 --- a/src/collection.ts +++ b/src/collection.ts @@ -1237,11 +1237,11 @@ export class Collection { * @param callback - An optional callback, a Promise will be returned if none is provided */ findOneAndDelete(filter: Filter): Promise>; - findOneAndDelete(filter: Filter, callback: Callback>): void; findOneAndDelete( filter: Filter, options: FindOneAndDeleteOptions ): Promise>; + findOneAndDelete(filter: Filter, callback: Callback>): void; findOneAndDelete( filter: Filter, options: FindOneAndDeleteOptions, diff --git a/test/functional/crud_spec.test.js b/test/functional/crud_spec.test.js index 14c4da4244..2cda5ac4b2 100644 --- a/test/functional/crud_spec.test.js +++ b/test/functional/crud_spec.test.js @@ -6,10 +6,6 @@ const chai = require('chai'); const expect = chai.expect; chai.use(require('chai-subset')); -const TestRunnerContext = require('./spec-runner').TestRunnerContext; -const gatherTestSuites = require('./spec-runner').gatherTestSuites; -const generateTopologyTests = require('./spec-runner').generateTopologyTests; - const { loadSpecTests } = require('../spec/index'); const { runUnifiedTest } = require('./unified-spec-runner/runner'); @@ -425,17 +421,6 @@ describe('CRUD spec', function () { } }); -describe('CRUD v2', function () { - const testContext = new TestRunnerContext(); - const testSuites = gatherTestSuites(path.resolve(__dirname, '../spec/crud/v2')); - after(() => testContext.teardown()); - before(function () { - return testContext.setup(this.configuration); - }); - - generateTopologyTests(testSuites, testContext); -}); - describe('CRUD unified', function () { for (const crudSpecTest of loadSpecTests('crud/unified')) { expect(crudSpecTest).to.exist; diff --git a/test/functional/unified-spec-runner/operations.ts b/test/functional/unified-spec-runner/operations.ts index 16ac952f88..42baf39e6b 100644 --- a/test/functional/unified-spec-runner/operations.ts +++ b/test/functional/unified-spec-runner/operations.ts @@ -270,6 +270,12 @@ operations.set('findOneAndUpdate', async ({ entities, operation }) => { return (await collection.findOneAndUpdate(filter, update, translateOptions(opts))).value; }); +operations.set('findOneAndDelete', async ({ entities, operation }) => { + const collection = entities.getEntity('collection', operation.object); + const { filter, ...opts } = operation.arguments; + return (await collection.findOneAndDelete(filter, opts)).value; +}); + operations.set('failPoint', async ({ entities, operation }) => { const client = entities.getEntity('client', operation.arguments.client); return entities.failPoints.enableFailPoint(client, operation.arguments.failPoint); @@ -409,12 +415,6 @@ operations.set('estimatedDocumentCount', async ({ entities, operation }) => { return collection.estimatedDocumentCount(operation.arguments); }); -operations.set('findOneAndDelete', async ({ entities, operation }) => { - const collection = entities.getEntity('collection', operation.object); - const { filter, ...opts } = operation.arguments; - return collection.findOneAndDelete(filter, opts); -}); - operations.set('runCommand', async ({ entities, operation }: OperationFunctionParams) => { const db = entities.getEntity('db', operation.object); const { command, ...opts } = operation.arguments; diff --git a/test/spec/crud/unified/aggregate-let.json b/test/spec/crud/unified/aggregate-let.json index b031b64cf0..d3b76bd65a 100644 --- a/test/spec/crud/unified/aggregate-let.json +++ b/test/spec/crud/unified/aggregate-let.json @@ -1,6 +1,6 @@ { "description": "aggregate-let", - "schemaVersion": "1.0", + "schemaVersion": "1.4", "createEntities": [ { "client": { @@ -23,6 +23,13 @@ "database": "database0", "collectionName": "coll0" } + }, + { + "collection": { + "id": "collection1", + "database": "database0", + "collectionName": "coll1" + } } ], "initialData": [ @@ -34,6 +41,11 @@ "_id": 1 } ] + }, + { + "collectionName": "coll1", + "databaseName": "crud-tests", + "documents": [] } ], "tests": [ @@ -293,6 +305,175 @@ ] } ] + }, + { + "description": "Aggregate to collection with let option", + "runOnRequirements": [ + { + "minServerVersion": "5.0", + "serverless": "forbid" + } + ], + "operations": [ + { + "name": "aggregate", + "object": "collection0", + "arguments": { + "pipeline": [ + { + "$match": { + "$expr": { + "$eq": [ + "$_id", + "$$id" + ] + } + } + }, + { + "$project": { + "_id": 1 + } + }, + { + "$out": "coll1" + } + ], + "let": { + "id": 1 + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "coll0", + "pipeline": [ + { + "$match": { + "$expr": { + "$eq": [ + "$_id", + "$$id" + ] + } + } + }, + { + "$project": { + "_id": 1 + } + }, + { + "$out": "coll1" + } + ], + "let": { + "id": 1 + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "coll1", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "Aggregate to collection with let option unsupported (server-side error)", + "runOnRequirements": [ + { + "minServerVersion": "2.6.0", + "maxServerVersion": "4.4.99" + } + ], + "operations": [ + { + "name": "aggregate", + "object": "collection0", + "arguments": { + "pipeline": [ + { + "$match": { + "$expr": { + "$eq": [ + "$_id", + "$$id" + ] + } + } + }, + { + "$project": { + "_id": 1 + } + }, + { + "$out": "coll1" + } + ], + "let": { + "id": 1 + } + }, + "expectError": { + "errorContains": "unrecognized field 'let'", + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "coll0", + "pipeline": [ + { + "$match": { + "$expr": { + "$eq": [ + "$_id", + "$$id" + ] + } + } + }, + { + "$project": { + "_id": 1 + } + }, + { + "$out": "coll1" + } + ], + "let": { + "id": 1 + } + } + } + } + ] + } + ] } ] } diff --git a/test/spec/crud/unified/aggregate-let.yml b/test/spec/crud/unified/aggregate-let.yml index ef6ce1558e..80da3d90b3 100644 --- a/test/spec/crud/unified/aggregate-let.yml +++ b/test/spec/crud/unified/aggregate-let.yml @@ -1,6 +1,6 @@ description: "aggregate-let" -schemaVersion: "1.0" +schemaVersion: "1.4" createEntities: - client: @@ -14,12 +14,19 @@ createEntities: id: &collection0 collection0 database: *database0 collectionName: &collection0Name coll0 + - collection: + id: &collection1 collection1 + database: *database0 + collectionName: &collection1Name coll1 initialData: &initialData - collectionName: *collection0Name databaseName: *database0Name documents: - { _id: 1 } + - collectionName: *collection1Name + databaseName: *database0Name + documents: [ ] tests: # TODO: Once SERVER-57403 is resolved, this test can be removed in favor of @@ -115,3 +122,53 @@ tests: aggregate: *collection0Name pipeline: *pipeline1 let: *let1 + + - description: "Aggregate to collection with let option" + runOnRequirements: + - minServerVersion: "5.0" + serverless: "forbid" + operations: + - name: aggregate + object: *collection0 + arguments: + pipeline: &pipeline2 + - $match: { $expr: { $eq: ["$_id", "$$id"] } } + - $project: { _id: 1 } + - $out: *collection1Name + let: &let2 + id: 1 + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + aggregate: *collection0Name + pipeline: *pipeline2 + let: *let2 + outcome: + - collectionName: *collection1Name + databaseName: *database0Name + documents: + - { _id: 1 } + + - description: "Aggregate to collection with let option unsupported (server-side error)" + runOnRequirements: + - minServerVersion: "2.6.0" + maxServerVersion: "4.4.99" + operations: + - name: aggregate + object: *collection0 + arguments: + pipeline: *pipeline2 + let: *let2 + expectError: + errorContains: "unrecognized field 'let'" + isClientError: false + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + aggregate: *collection0Name + pipeline: *pipeline2 + let: *let2 diff --git a/test/spec/crud/unified/aggregate-merge.json b/test/spec/crud/unified/aggregate-merge.json new file mode 100644 index 0000000000..ac61ceb8a6 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/aggregate-merge.yml b/test/spec/crud/unified/aggregate-merge.yml new file mode 100644 index 0000000000..821f03e1c6 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/aggregate-out-readConcern.json b/test/spec/crud/unified/aggregate-out-readConcern.json new file mode 100644 index 0000000000..e293457c1c --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/aggregate-out-readConcern.yml b/test/spec/crud/unified/aggregate-out-readConcern.yml new file mode 100644 index 0000000000..c210c46929 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/aggregate.json b/test/spec/crud/unified/aggregate.json new file mode 100644 index 0000000000..dcdad761e8 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/aggregate.yml b/test/spec/crud/unified/aggregate.yml new file mode 100644 index 0000000000..248b91cefb --- /dev/null +++ b/test/spec/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/test/spec/crud/v2/bulkWrite-arrayFilters-clientError.json b/test/spec/crud/unified/bulkWrite-arrayFilters-clientError.json similarity index 53% rename from test/spec/crud/v2/bulkWrite-arrayFilters-clientError.json rename to test/spec/crud/unified/bulkWrite-arrayFilters-clientError.json index 22e22f0efb..63815e3233 100644 --- a/test/spec/crud/v2/bulkWrite-arrayFilters-clientError.json +++ b/test/spec/crud/unified/bulkWrite-arrayFilters-clientError.json @@ -1,29 +1,61 @@ { - "runOn": [ + "description": "bulkWrite-arrayFilters-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ { "maxServerVersion": "3.5.5" } ], - "data": [ + "createEntities": [ { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 1 - } - ] + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } }, { - "_id": 2, - "y": [ + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "crud-v2" + } + } + ], + "initialData": [ + { + "collectionName": "crud-v2", + "databaseName": "crud-v2", + "documents": [ { - "b": 0 + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 1 + } + ] }, { - "b": 1 + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] } ] } @@ -33,12 +65,12 @@ "description": "BulkWrite on server that doesn't support arrayFilters", "operations": [ { + "object": "collection0", "name": "bulkWrite", "arguments": { "requests": [ { - "name": "updateOne", - "arguments": { + "updateOne": { "filter": {}, "update": { "$set": { @@ -53,25 +85,30 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [] + "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": [ { - "name": "updateOne", - "arguments": { + "updateOne": { "filter": {}, "update": { "$set": { @@ -81,8 +118,7 @@ } }, { - "name": "updateMany", - "arguments": { + "updateMany": { "filter": {}, "update": { "$set": { @@ -97,14 +133,19 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [] + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] } ] } diff --git a/test/spec/crud/unified/bulkWrite-arrayFilters-clientError.yml b/test/spec/crud/unified/bulkWrite-arrayFilters-clientError.yml new file mode 100644 index 0000000000..8b4c7a1c9e --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/bulkWrite-arrayFilters.json b/test/spec/crud/unified/bulkWrite-arrayFilters.json new file mode 100644 index 0000000000..70ee014f7a --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/bulkWrite-arrayFilters.yml b/test/spec/crud/unified/bulkWrite-arrayFilters.yml new file mode 100644 index 0000000000..a236acb12d --- /dev/null +++ b/test/spec/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/test/spec/crud/v2/bulkWrite-delete-hint-clientError.json b/test/spec/crud/unified/bulkWrite-delete-hint-clientError.json similarity index 54% rename from test/spec/crud/v2/bulkWrite-delete-hint-clientError.json rename to test/spec/crud/unified/bulkWrite-delete-hint-clientError.json index cfeac904ca..2961b55dc0 100644 --- a/test/spec/crud/v2/bulkWrite-delete-hint-clientError.json +++ b/test/spec/crud/unified/bulkWrite-delete-hint-clientError.json @@ -1,39 +1,70 @@ { - "runOn": [ + "description": "bulkWrite-delete-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ { "maxServerVersion": "3.3.99" } ], - "data": [ + "createEntities": [ { - "_id": 1, - "x": 11 + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } }, { - "_id": 2, - "x": 22 + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } }, { - "_id": 3, - "x": 33 - }, + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "BulkWrite_delete_hint" + } + } + ], + "initialData": [ { - "_id": 4, - "x": 44 + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_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": [ { + "object": "collection0", "name": "bulkWrite", "arguments": { "requests": [ { - "name": "deleteOne", - "arguments": { + "deleteOne": { "filter": { "_id": 1 }, @@ -41,8 +72,7 @@ } }, { - "name": "deleteOne", - "arguments": { + "deleteOne": { "filter": { "_id": 2 }, @@ -52,17 +82,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -81,18 +118,18 @@ } ] } - } + ] }, { "description": "BulkWrite deleteMany with hints unsupported (client-side error)", "operations": [ { + "object": "collection0", "name": "bulkWrite", "arguments": { "requests": [ { - "name": "deleteMany", - "arguments": { + "deleteMany": { "filter": { "_id": { "$lt": 3 @@ -102,8 +139,7 @@ } }, { - "name": "deleteMany", - "arguments": { + "deleteMany": { "filter": { "_id": { "$gte": 4 @@ -115,17 +151,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -144,7 +187,7 @@ } ] } - } + ] } ] } diff --git a/test/spec/crud/unified/bulkWrite-delete-hint-clientError.yml b/test/spec/crud/unified/bulkWrite-delete-hint-clientError.yml new file mode 100644 index 0000000000..2b0bdb1c21 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/bulkWrite-delete-hint-serverError.json b/test/spec/crud/unified/bulkWrite-delete-hint-serverError.json new file mode 100644 index 0000000000..fa99522093 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/bulkWrite-delete-hint-serverError.yml b/test/spec/crud/unified/bulkWrite-delete-hint-serverError.yml new file mode 100644 index 0000000000..e757bade0c --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/bulkWrite-delete-hint.json b/test/spec/crud/unified/bulkWrite-delete-hint.json new file mode 100644 index 0000000000..9fcdecefd7 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/bulkWrite-delete-hint.yml b/test/spec/crud/unified/bulkWrite-delete-hint.yml new file mode 100644 index 0000000000..8b7f84aa94 --- /dev/null +++ b/test/spec/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/test/spec/crud/v2/bulkWrite-update-hint-clientError.json b/test/spec/crud/unified/bulkWrite-update-hint-clientError.json similarity index 63% rename from test/spec/crud/v2/bulkWrite-update-hint-clientError.json rename to test/spec/crud/unified/bulkWrite-update-hint-clientError.json index fa919ec515..d5eb71c29e 100644 --- a/test/spec/crud/v2/bulkWrite-update-hint-clientError.json +++ b/test/spec/crud/unified/bulkWrite-update-hint-clientError.json @@ -1,39 +1,70 @@ { - "runOn": [ + "description": "bulkWrite-update-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ { "maxServerVersion": "3.3.99" } ], - "data": [ + "createEntities": [ { - "_id": 1, - "x": 11 + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } }, { - "_id": 2, - "x": 22 + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } }, { - "_id": 3, - "x": 33 - }, + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_bulkwrite_update_hint" + } + } + ], + "initialData": [ { - "_id": 4, - "x": 44 + "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 + } + ] } ], - "collection_name": "test_bulkwrite_update_hint", "tests": [ { "description": "BulkWrite updateOne with update hints unsupported (client-side error)", "operations": [ { + "object": "collection0", "name": "bulkWrite", "arguments": { "requests": [ { - "name": "updateOne", - "arguments": { + "updateOne": { "filter": { "_id": 1 }, @@ -46,8 +77,7 @@ } }, { - "name": "updateOne", - "arguments": { + "updateOne": { "filter": { "_id": 1 }, @@ -62,17 +92,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -91,18 +128,18 @@ } ] } - } + ] }, { "description": "BulkWrite updateMany with update hints unsupported (client-side error)", "operations": [ { + "object": "collection0", "name": "bulkWrite", "arguments": { "requests": [ { - "name": "updateMany", - "arguments": { + "updateMany": { "filter": { "_id": { "$lt": 3 @@ -117,8 +154,7 @@ } }, { - "name": "updateMany", - "arguments": { + "updateMany": { "filter": { "_id": { "$lt": 3 @@ -135,17 +171,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -164,18 +207,18 @@ } ] } - } + ] }, { "description": "BulkWrite replaceOne with update hints unsupported (client-side error)", "operations": [ { + "object": "collection0", "name": "bulkWrite", "arguments": { "requests": [ { - "name": "replaceOne", - "arguments": { + "replaceOne": { "filter": { "_id": 3 }, @@ -186,8 +229,7 @@ } }, { - "name": "replaceOne", - "arguments": { + "replaceOne": { "filter": { "_id": 4 }, @@ -200,17 +242,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -229,7 +278,7 @@ } ] } - } + ] } ] } diff --git a/test/spec/crud/unified/bulkWrite-update-hint-clientError.yml b/test/spec/crud/unified/bulkWrite-update-hint-clientError.yml new file mode 100644 index 0000000000..df1eae485e --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/bulkWrite-update-hint-serverError.json b/test/spec/crud/unified/bulkWrite-update-hint-serverError.json new file mode 100644 index 0000000000..b0f7e1b381 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/bulkWrite-update-hint-serverError.yml b/test/spec/crud/unified/bulkWrite-update-hint-serverError.yml new file mode 100644 index 0000000000..bda128b55d --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/bulkWrite-update-hint.json b/test/spec/crud/unified/bulkWrite-update-hint.json new file mode 100644 index 0000000000..4206359891 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/bulkWrite-update-hint.yml b/test/spec/crud/unified/bulkWrite-update-hint.yml new file mode 100644 index 0000000000..9f5a0e080e --- /dev/null +++ b/test/spec/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/test/spec/crud/v2/bulkWrite-update-validation.json b/test/spec/crud/unified/bulkWrite-update-validation.json similarity index 54% rename from test/spec/crud/v2/bulkWrite-update-validation.json rename to test/spec/crud/unified/bulkWrite-update-validation.json index 481e13c45c..f9bfda0edd 100644 --- a/test/spec/crud/v2/bulkWrite-update-validation.json +++ b/test/spec/crud/unified/bulkWrite-update-validation.json @@ -1,16 +1,48 @@ { - "data": [ + "description": "bulkWrite-update-validation", + "schemaVersion": "1.0", + "createEntities": [ { - "_id": 1, - "x": 11 + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } }, { - "_id": 2, - "x": 22 + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-tests" + } }, { - "_id": 3, - "x": 33 + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] } ], "tests": [ @@ -19,11 +51,11 @@ "operations": [ { "name": "bulkWrite", + "object": "collection0", "arguments": { "requests": [ { - "name": "replaceOne", - "arguments": { + "replaceOne": { "filter": { "_id": 1 }, @@ -36,13 +68,22 @@ } ] }, - "error": true + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ { "_id": 1, "x": 11 @@ -57,18 +98,18 @@ } ] } - } + ] }, { "description": "BulkWrite updateOne requires atomic modifiers", "operations": [ { "name": "bulkWrite", + "object": "collection0", "arguments": { "requests": [ { - "name": "updateOne", - "arguments": { + "updateOne": { "filter": { "_id": 1 }, @@ -79,13 +120,22 @@ } ] }, - "error": true + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ { "_id": 1, "x": 11 @@ -100,18 +150,18 @@ } ] } - } + ] }, { "description": "BulkWrite updateMany requires atomic modifiers", "operations": [ { "name": "bulkWrite", + "object": "collection0", "arguments": { "requests": [ { - "name": "updateMany", - "arguments": { + "updateMany": { "filter": { "_id": { "$gt": 1 @@ -124,13 +174,22 @@ } ] }, - "error": true + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ { "_id": 1, "x": 11 @@ -145,7 +204,7 @@ } ] } - } + ] } ] } diff --git a/test/spec/crud/unified/bulkWrite-update-validation.yml b/test/spec/crud/unified/bulkWrite-update-validation.yml new file mode 100644 index 0000000000..57defd56a4 --- /dev/null +++ b/test/spec/crud/unified/bulkWrite-update-validation.yml @@ -0,0 +1,73 @@ +description: "bulkWrite-update-validation" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name crud-tests + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: &initialData + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + +tests: + - description: "BulkWrite replaceOne prohibits atomic modifiers" + operations: + - name: bulkWrite + object: *collection0 + arguments: + requests: + - replaceOne: + filter: { _id: 1 } + replacement: { $set: { x: 22 } } + expectError: + isClientError: true + expectEvents: + - client: *client0 + events: [] + outcome: *initialData + + - description: "BulkWrite updateOne requires atomic modifiers" + operations: + - name: bulkWrite + object: *collection0 + arguments: + requests: + - updateOne: + filter: { _id: 1 } + update: { x: 22 } + expectError: + isClientError: true + expectEvents: + - client: *client0 + events: [] + outcome: *initialData + + - description: "BulkWrite updateMany requires atomic modifiers" + operations: + - name: bulkWrite + object: *collection0 + arguments: + requests: + - updateMany: + filter: { _id: { $gt: 1 } } + update: { x: 44 } + expectError: + isClientError: true + expectEvents: + - client: *client0 + events: [] + outcome: *initialData diff --git a/test/spec/crud/unified/crud-let.json b/test/spec/crud/unified/crud-let.json deleted file mode 100644 index d0612dfd58..0000000000 --- a/test/spec/crud/unified/crud-let.json +++ /dev/null @@ -1,513 +0,0 @@ -{ - "description": "crud-let", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": "foo" - } - ] - } - ], - "tests": [ - { - "description": "Find with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "let": { - "id": 1 - } - }, - "expectResult": [ - { - "x": "foo" - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "let": { - "id": 1 - } - } - } - } - ] - } - ] - }, - { - "description": "Find with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "$match": { - "_id": 1 - } - }, - "let": { - "x": "foo" - } - }, - "expectError": { - "errorContains": "Unrecognized field 'let'", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": { - "$match": { - "_id": 1 - } - }, - "let": { - "x": "foo" - } - } - } - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": { - "$set": {} - }, - "let": { - "id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": { - "$set": {} - }, - "let": { - "id": 1 - } - } - } - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "$match": { - "_id": 1 - } - }, - "update": { - "$set": {} - }, - "let": { - "x": "foo" - } - }, - "expectError": { - "errorContains": "'let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "$match": { - "_id": 1 - } - }, - "update": { - "$set": {} - }, - "let": { - "x": "foo" - } - } - } - } - ] - } - ] - }, - { - "description": "Update with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": { - "$set": {} - }, - "let": { - "id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "u": { - "$set": {} - } - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ] - }, - { - "description": "Update with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": { - "$set": {} - }, - "let": { - "id": 1 - } - }, - "expectError": { - "errorContains": "'update.let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "u": { - "$set": {} - } - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ] - }, - { - "description": "Delete with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "let": { - "id": 10 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "limit": 1 - } - ], - "let": { - "id": 10 - } - } - } - } - ] - } - ] - }, - { - "description": "Delete with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "let": { - "id": 10 - } - }, - "expectError": { - "errorContains": "'delete.let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "limit": 1 - } - ], - "let": { - "id": 10 - } - } - } - } - ] - } - ] - } - ] -} diff --git a/test/spec/crud/unified/crud-let.yml b/test/spec/crud/unified/crud-let.yml deleted file mode 100644 index e7bd22b036..0000000000 --- a/test/spec/crud/unified/crud-let.yml +++ /dev/null @@ -1,221 +0,0 @@ -# NOTE: Not yet committed upstream as a spec test! - -description: "crud-let" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 client0 - observeEvents: [ commandStartedEvent ] - - database: - id: &database0 database0 - client: *client0 - databaseName: &database0Name crud-tests - - collection: - id: &collection0 collection0 - database: *database0 - collectionName: &collection0Name coll0 - -initialData: &initialData - - collectionName: *collection0Name - databaseName: *database0Name - documents: - - { _id: 1, x: "foo" } - -tests: - - description: "Find with let option" - runOnRequirements: - - minServerVersion: "5.0" - operations: - - name: find - object: *collection0 - arguments: - filter: &query0 - $expr: { $eq: ["$_id", "$$id"] } - let: &let0 - id: 1 - expectResult: - - { x: "foo" } - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - find: *collection0Name - filter: *query0 - let: *let0 - - - description: "Find with let option unsupported (server-side error)" - runOnRequirements: - - minServerVersion: "4.2.0" - maxServerVersion: "4.4.99" - operations: - - name: find - object: *collection0 - arguments: - filter: &query1 - $match: { _id: 1 } - let: &let1 - x: foo - expectError: - errorContains: "Unrecognized field 'let'" - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - find: *collection0Name - filter: *query1 - let: *let1 - - - description: "FindOneAndUpdate with let option" - runOnRequirements: - - minServerVersion: "5.0" - operations: - - name: findOneAndUpdate - object: *collection0 - arguments: - filter: &query2 - $expr: { $eq: ["$_id", "$$id"] } - update: &update2 - $set: {} - let: &let2 - id: 1 - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - findAndModify: *collection0Name - query: *query2 - update: *update2 - let: *let2 - - - description: "FindOneAndUpdate with let option unsupported (server-side error)" - runOnRequirements: - - minServerVersion: "4.2.0" - maxServerVersion: "4.4.99" - operations: - - name: findOneAndUpdate - object: *collection0 - arguments: - filter: &query3 - $match: { _id: 1 } - update: &update3 - $set: {} - let: &let3 - x: foo - expectError: - errorContains: "'let' is an unknown field" - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - findAndModify: *collection0Name - query: *query3 - update: *update3 - let: *let3 - - - description: "Update with let option" - runOnRequirements: - - minServerVersion: "5.0" - operations: - - name: updateOne - object: *collection0 - arguments: - filter: &query4 - $expr: { $eq: ["$_id", "$$id"] } - update: &update4 - $set: {} - let: &let4 - id: 1 - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - update: *collection0Name - updates: - - q: *query4 - u: *update4 - let: *let4 - - - description: "Update with let option unsupported (server-side error)" - runOnRequirements: - - minServerVersion: "4.2.0" - maxServerVersion: "4.4.99" - operations: - - name: updateOne - object: *collection0 - arguments: - filter: &query5 - $expr: { $eq: ["$_id", "$$id"] } - update: &update5 - $set: {} - let: &let5 - id: 1 - expectError: - errorContains: "'update.let' is an unknown field" - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - update: *collection0Name - updates: - - q: *query5 - u: *update5 - let: *let5 - - - description: "Delete with let option" - runOnRequirements: - - minServerVersion: "5.0" - operations: - - name: deleteOne - object: *collection0 - arguments: - filter: &query6 - $expr: { $eq: ["$_id", "$$id"] } - let: &let6 - id: 10 - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - delete: *collection0Name - deletes: - - q: *query6 - limit: 1 - let: *let6 - - - description: "Delete with let option unsupported (server-side error)" - runOnRequirements: - - minServerVersion: "4.2.0" - maxServerVersion: "4.4.99" - operations: - - name: deleteOne - object: *collection0 - arguments: - filter: &query7 - $expr: { $eq: ["$_id", "$$id"] } - let: &let7 - id: 10 - expectError: - errorContains: "'delete.let' is an unknown field" - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - delete: *collection0Name - deletes: - - q: *query7 - limit: 1 - let: *let7 diff --git a/test/spec/crud/v2/db-aggregate.json b/test/spec/crud/unified/db-aggregate.json similarity index 68% rename from test/spec/crud/v2/db-aggregate.json rename to test/spec/crud/unified/db-aggregate.json index d88b9e1819..5015405bfc 100644 --- a/test/spec/crud/v2/db-aggregate.json +++ b/test/spec/crud/unified/db-aggregate.json @@ -1,17 +1,43 @@ { - "runOn": [ + "description": "db-aggregate", + "schemaVersion": "1.4", + "runOnRequirements": [ { - "minServerVersion": "3.6.0" + "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" + } } ], - "database_name": "admin", "tests": [ { "description": "Aggregate with $listLocalSessions", "operations": [ { + "object": "database0", "name": "aggregate", - "object": "database", "arguments": { "pipeline": [ { @@ -33,7 +59,7 @@ } ] }, - "result": [ + "expectResult": [ { "dummy": "dummy field" } @@ -45,8 +71,8 @@ "description": "Aggregate with $listLocalSessions and allowDiskUse", "operations": [ { + "object": "database0", "name": "aggregate", - "object": "database", "arguments": { "pipeline": [ { @@ -69,7 +95,7 @@ ], "allowDiskUse": true }, - "result": [ + "expectResult": [ { "dummy": "dummy field" } diff --git a/test/spec/crud/unified/db-aggregate.yml b/test/spec/crud/unified/db-aggregate.yml new file mode 100644 index 0000000000..032f94c731 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/deleteMany-hint-clientError.json b/test/spec/crud/unified/deleteMany-hint-clientError.json new file mode 100644 index 0000000000..66320122b5 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/deleteMany-hint-clientError.yml b/test/spec/crud/unified/deleteMany-hint-clientError.yml new file mode 100644 index 0000000000..21ff1debbe --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/deleteMany-hint-serverError.json b/test/spec/crud/unified/deleteMany-hint-serverError.json new file mode 100644 index 0000000000..88d4a65576 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/deleteMany-hint-serverError.yml b/test/spec/crud/unified/deleteMany-hint-serverError.yml new file mode 100644 index 0000000000..2e20988d0b --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/deleteMany-hint.json b/test/spec/crud/unified/deleteMany-hint.json new file mode 100644 index 0000000000..59d903d201 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/deleteMany-hint.yml b/test/spec/crud/unified/deleteMany-hint.yml new file mode 100644 index 0000000000..512b95e76b --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/deleteOne-hint-clientError.json b/test/spec/crud/unified/deleteOne-hint-clientError.json new file mode 100644 index 0000000000..cf629f59e0 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/deleteOne-hint-clientError.yml b/test/spec/crud/unified/deleteOne-hint-clientError.yml new file mode 100644 index 0000000000..be218fc9b5 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/deleteOne-hint-serverError.json b/test/spec/crud/unified/deleteOne-hint-serverError.json new file mode 100644 index 0000000000..15541ed857 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/deleteOne-hint-serverError.yml b/test/spec/crud/unified/deleteOne-hint-serverError.yml new file mode 100644 index 0000000000..6c8c0ea817 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/deleteOne-hint.json b/test/spec/crud/unified/deleteOne-hint.json new file mode 100644 index 0000000000..bcc4bc2347 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/deleteOne-hint.yml b/test/spec/crud/unified/deleteOne-hint.yml new file mode 100644 index 0000000000..f72356c99c --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/find-allowdiskuse-clientError.json b/test/spec/crud/unified/find-allowdiskuse-clientError.json new file mode 100644 index 0000000000..5bd954e79d --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/find-allowdiskuse-clientError.yml b/test/spec/crud/unified/find-allowdiskuse-clientError.yml new file mode 100644 index 0000000000..2bc26908fe --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/find-allowdiskuse-serverError.json b/test/spec/crud/unified/find-allowdiskuse-serverError.json new file mode 100644 index 0000000000..dc58f8f0e3 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/find-allowdiskuse-serverError.yml b/test/spec/crud/unified/find-allowdiskuse-serverError.yml new file mode 100644 index 0000000000..de73d8b37d --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/find-allowdiskuse.json b/test/spec/crud/unified/find-allowdiskuse.json new file mode 100644 index 0000000000..789bb7fbf1 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/find-allowdiskuse.yml b/test/spec/crud/unified/find-allowdiskuse.yml new file mode 100644 index 0000000000..b2de4037dc --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/find.json b/test/spec/crud/unified/find.json new file mode 100644 index 0000000000..275d5d351a --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/find.yml b/test/spec/crud/unified/find.yml new file mode 100644 index 0000000000..5615f07234 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/findOneAndDelete-hint-clientError.json b/test/spec/crud/unified/findOneAndDelete-hint-clientError.json new file mode 100644 index 0000000000..c6ff467866 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/findOneAndDelete-hint-clientError.yml b/test/spec/crud/unified/findOneAndDelete-hint-clientError.yml new file mode 100644 index 0000000000..220496872a --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/findOneAndDelete-hint-serverError.json b/test/spec/crud/unified/findOneAndDelete-hint-serverError.json new file mode 100644 index 0000000000..b874102728 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/findOneAndDelete-hint-serverError.yml b/test/spec/crud/unified/findOneAndDelete-hint-serverError.yml new file mode 100644 index 0000000000..5fd21eedc0 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/findOneAndDelete-hint.json b/test/spec/crud/unified/findOneAndDelete-hint.json new file mode 100644 index 0000000000..8b53f2bd3f --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/findOneAndDelete-hint.yml b/test/spec/crud/unified/findOneAndDelete-hint.yml new file mode 100644 index 0000000000..3dc4f3ff41 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/findOneAndReplace-hint-clientError.json b/test/spec/crud/unified/findOneAndReplace-hint-clientError.json new file mode 100644 index 0000000000..6b07eb1f4d --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/findOneAndReplace-hint-clientError.yml b/test/spec/crud/unified/findOneAndReplace-hint-clientError.yml new file mode 100644 index 0000000000..f59952ffc0 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/findOneAndReplace-hint-serverError.json b/test/spec/crud/unified/findOneAndReplace-hint-serverError.json new file mode 100644 index 0000000000..7fbf5a0ea3 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/findOneAndReplace-hint-serverError.yml b/test/spec/crud/unified/findOneAndReplace-hint-serverError.yml new file mode 100644 index 0000000000..664cd0bbc5 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/findOneAndReplace-hint.json b/test/spec/crud/unified/findOneAndReplace-hint.json new file mode 100644 index 0000000000..d07c5921a7 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/findOneAndReplace-hint.yml b/test/spec/crud/unified/findOneAndReplace-hint.yml new file mode 100644 index 0000000000..9c581270a7 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/findOneAndUpdate-hint-clientError.json b/test/spec/crud/unified/findOneAndUpdate-hint-clientError.json new file mode 100644 index 0000000000..d0b51313c9 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/findOneAndUpdate-hint-clientError.yml b/test/spec/crud/unified/findOneAndUpdate-hint-clientError.yml new file mode 100644 index 0000000000..5ad4f07ccf --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/findOneAndUpdate-hint-serverError.json b/test/spec/crud/unified/findOneAndUpdate-hint-serverError.json new file mode 100644 index 0000000000..99fd9938f8 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/findOneAndUpdate-hint-serverError.yml b/test/spec/crud/unified/findOneAndUpdate-hint-serverError.yml new file mode 100644 index 0000000000..f6b4f8d623 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/findOneAndUpdate-hint.json b/test/spec/crud/unified/findOneAndUpdate-hint.json new file mode 100644 index 0000000000..5be6d2b3e8 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/findOneAndUpdate-hint.yml b/test/spec/crud/unified/findOneAndUpdate-hint.yml new file mode 100644 index 0000000000..5e835faa9e --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/insertMany-dots_and_dollars.json b/test/spec/crud/unified/insertMany-dots_and_dollars.json index 3b66ac0621..eed8997df9 100644 --- a/test/spec/crud/unified/insertMany-dots_and_dollars.json +++ b/test/spec/crud/unified/insertMany-dots_and_dollars.json @@ -53,10 +53,11 @@ ] }, "expectResult": { - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 1 + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 1 + } } } } @@ -162,10 +163,11 @@ ] }, "expectResult": { - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 1 + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 1 + } } } } @@ -221,10 +223,11 @@ ] }, "expectResult": { - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 1 + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 1 + } } } } @@ -284,10 +287,11 @@ ] }, "expectResult": { - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 1 + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 1 + } } } } diff --git a/test/spec/crud/unified/insertMany-dots_and_dollars.yml b/test/spec/crud/unified/insertMany-dots_and_dollars.yml index 63bbe16197..913a55e4c0 100644 --- a/test/spec/crud/unified/insertMany-dots_and_dollars.yml +++ b/test/spec/crud/unified/insertMany-dots_and_dollars.yml @@ -31,8 +31,8 @@ tests: documents: - &dollarPrefixedKey { _id: 1, $a: 1 } expectResult: &insertResult - insertedCount: 1 - insertedIds: { $$unsetOrMatches: { 0: 1 } } + # InsertManyResult is optional because all of its fields are optional + $$unsetOrMatches: { insertedIds: { $$unsetOrMatches: { 0: 1 } } } expectEvents: &expectEventsDollarPrefixedKey - client: *client0 events: diff --git a/test/spec/crud/unified/insertOne-dots_and_dollars.json b/test/spec/crud/unified/insertOne-dots_and_dollars.json index 4b9fbfb80b..fdc17af2e8 100644 --- a/test/spec/crud/unified/insertOne-dots_and_dollars.json +++ b/test/spec/crud/unified/insertOne-dots_and_dollars.json @@ -63,8 +63,10 @@ } }, "expectResult": { - "insertedId": { - "$$unsetOrMatches": 1 + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } } } } @@ -165,8 +167,10 @@ } }, "expectResult": { - "insertedId": { - "$$unsetOrMatches": 1 + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } } } } @@ -219,8 +223,10 @@ } }, "expectResult": { - "insertedId": { - "$$unsetOrMatches": 1 + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } } } } @@ -277,8 +283,10 @@ } }, "expectResult": { - "insertedId": { - "$$unsetOrMatches": 1 + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } } } } @@ -386,9 +394,11 @@ } }, "expectResult": { - "insertedId": { - "$$unsetOrMatches": { - "a.b": 1 + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": { + "a.b": 1 + } } } } @@ -496,8 +506,10 @@ } }, "expectResult": { - "insertedId": { - "$$unsetOrMatches": 1 + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } } } } @@ -558,8 +570,10 @@ } }, "expectResult": { - "acknowledged": { - "$$unsetOrMatches": false + "$$unsetOrMatches": { + "acknowledged": { + "$$unsetOrMatches": false + } } } } diff --git a/test/spec/crud/unified/insertOne-dots_and_dollars.yml b/test/spec/crud/unified/insertOne-dots_and_dollars.yml index f23fec2d51..f255b52413 100644 --- a/test/spec/crud/unified/insertOne-dots_and_dollars.yml +++ b/test/spec/crud/unified/insertOne-dots_and_dollars.yml @@ -36,7 +36,8 @@ tests: arguments: document: &dollarPrefixedKey { _id: 1, $a: 1 } expectResult: &insertResult - insertedId: { $$unsetOrMatches: 1 } + # InsertOneResult is optional because all of its fields are optional + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } expectEvents: &expectEventsDollarPrefixedKey - client: *client0 events: @@ -155,7 +156,8 @@ tests: arguments: document: &dottedKeyInId { _id: { a.b: 1 } } expectResult: - insertedId: { $$unsetOrMatches: { a.b: 1 } } + # InsertOneResult is optional because all of its fields are optional + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: { a.b: 1 } } } expectEvents: &expectEventsDottedKeyInId - client: *client0 events: @@ -222,7 +224,8 @@ tests: arguments: document: *dollarPrefixedKeyInId expectResult: - acknowledged: { $$unsetOrMatches: false } + # InsertOneResult is optional because all of its fields are optional + $$unsetOrMatches: { acknowledged: { $$unsetOrMatches: false } } expectEvents: - client: *client0 events: diff --git a/test/spec/crud/unified/replaceOne-hint.json b/test/spec/crud/unified/replaceOne-hint.json new file mode 100644 index 0000000000..6926e9d8df --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/replaceOne-hint.yml b/test/spec/crud/unified/replaceOne-hint.yml new file mode 100644 index 0000000000..d00bf6744c --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/replaceOne-validation.json b/test/spec/crud/unified/replaceOne-validation.json new file mode 100644 index 0000000000..6f5b173e02 --- /dev/null +++ b/test/spec/crud/unified/replaceOne-validation.json @@ -0,0 +1,82 @@ +{ + "description": "replaceOne-validation", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ], + "tests": [ + { + "description": "ReplaceOne prohibits atomic modifiers", + "operations": [ + { + "name": "replaceOne", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "$set": { + "x": 22 + } + } + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/replaceOne-validation.yml b/test/spec/crud/unified/replaceOne-validation.yml new file mode 100644 index 0000000000..db5a2a6666 --- /dev/null +++ b/test/spec/crud/unified/replaceOne-validation.yml @@ -0,0 +1,37 @@ +description: "replaceOne-validation" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name crud-tests + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: &initialData + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + +tests: + - description: "ReplaceOne prohibits atomic modifiers" + operations: + - name: replaceOne + object: *collection0 + arguments: + filter: { _id: 1 } + replacement: { $set: { x: 22 } } + expectError: + isClientError: true + expectEvents: + - client: *client0 + events: [] + outcome: *initialData diff --git a/test/spec/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.json b/test/spec/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.json similarity index 53% rename from test/spec/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.json rename to test/spec/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.json index 46839db705..dbaa2e84f4 100644 --- a/test/spec/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.json +++ b/test/spec/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.json @@ -1,39 +1,70 @@ { - "data": [ + "description": "unacknowledged-bulkWrite-delete-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ { - "_id": 1, - "x": 11 + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } }, { - "_id": 2, - "x": 22 + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } }, { - "_id": 3, - "x": 33 - }, + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "BulkWrite_delete_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ { - "_id": 4, - "x": 44 + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_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": [ { + "object": "collection0", "name": "bulkWrite", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, "arguments": { "requests": [ { - "name": "deleteOne", - "arguments": { + "deleteOne": { "filter": { "_id": 1 }, @@ -41,8 +72,7 @@ } }, { - "name": "deleteOne", - "arguments": { + "deleteOne": { "filter": { "_id": 2 }, @@ -52,17 +82,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "outcome": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -81,23 +118,18 @@ } ] } - } + ] }, { "description": "Unacknowledged bulkWrite deleteMany with hints fails with client-side error", "operations": [ { + "object": "collection0", "name": "bulkWrite", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, "arguments": { "requests": [ { - "name": "deleteMany", - "arguments": { + "deleteMany": { "filter": { "_id": { "$lt": 3 @@ -107,8 +139,7 @@ } }, { - "name": "deleteMany", - "arguments": { + "deleteMany": { "filter": { "_id": { "$gte": 4 @@ -120,17 +151,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -149,7 +187,7 @@ } ] } - } + ] } ] } diff --git a/test/spec/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.yml new file mode 100644 index 0000000000..3aaa182436 --- /dev/null +++ b/test/spec/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/test/spec/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.json b/test/spec/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.json similarity index 62% rename from test/spec/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.json rename to test/spec/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.json index 4a41d76b35..858967b90c 100644 --- a/test/spec/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.json +++ b/test/spec/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.json @@ -1,39 +1,70 @@ { - "data": [ + "description": "unacknowledged-bulkWrite-update-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ { - "_id": 1, - "x": 11 + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } }, { - "_id": 2, - "x": 22 + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } }, { - "_id": 3, - "x": 33 - }, + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "Bulkwrite_update_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ { - "_id": 4, - "x": 44 + "collectionName": "Bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_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": [ { + "object": "collection0", "name": "bulkWrite", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, "arguments": { "requests": [ { - "name": "updateOne", - "arguments": { + "updateOne": { "filter": { "_id": 1 }, @@ -46,8 +77,7 @@ } }, { - "name": "updateOne", - "arguments": { + "updateOne": { "filter": { "_id": 1 }, @@ -62,17 +92,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "outcome": [ + { + "collectionName": "Bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -91,23 +128,18 @@ } ] } - } + ] }, { "description": "Unacknowledged bulkWrite updateMany with hints fails with client-side error", "operations": [ { + "object": "collection0", "name": "bulkWrite", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, "arguments": { "requests": [ { - "name": "updateMany", - "arguments": { + "updateMany": { "filter": { "_id": { "$lt": 3 @@ -122,8 +154,7 @@ } }, { - "name": "updateMany", - "arguments": { + "updateMany": { "filter": { "_id": { "$lt": 3 @@ -140,17 +171,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "Bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -169,23 +207,18 @@ } ] } - } + ] }, { "description": "Unacknowledged bulkWrite replaceOne with hints fails with client-side error", "operations": [ { + "object": "collection0", "name": "bulkWrite", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, "arguments": { "requests": [ { - "name": "replaceOne", - "arguments": { + "replaceOne": { "filter": { "_id": 3 }, @@ -196,8 +229,7 @@ } }, { - "name": "replaceOne", - "arguments": { + "replaceOne": { "filter": { "_id": 4 }, @@ -210,17 +242,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "Bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -239,7 +278,7 @@ } ] } - } + ] } ] } diff --git a/test/spec/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.yml new file mode 100644 index 0000000000..95620f097a --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/unacknowledged-deleteMany-hint-clientError.json b/test/spec/crud/unified/unacknowledged-deleteMany-hint-clientError.json new file mode 100644 index 0000000000..c5d9f6af36 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/unacknowledged-deleteMany-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-deleteMany-hint-clientError.yml new file mode 100644 index 0000000000..7acbbc7ca8 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/unacknowledged-deleteOne-hint-clientError.json b/test/spec/crud/unified/unacknowledged-deleteOne-hint-clientError.json new file mode 100644 index 0000000000..177ad889bb --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/unacknowledged-deleteOne-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-deleteOne-hint-clientError.yml new file mode 100644 index 0000000000..996dad6cac --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.json b/test/spec/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.json new file mode 100644 index 0000000000..6ee59cdf64 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.yml new file mode 100644 index 0000000000..7a619d30a0 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.json b/test/spec/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.json new file mode 100644 index 0000000000..15ca773228 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.yml new file mode 100644 index 0000000000..cbd12dac98 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.json b/test/spec/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.json new file mode 100644 index 0000000000..e18767f8b2 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.yml new file mode 100644 index 0000000000..b9cd0229cb --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/unacknowledged-replaceOne-hint-clientError.json b/test/spec/crud/unified/unacknowledged-replaceOne-hint-clientError.json new file mode 100644 index 0000000000..52ec59d0c0 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/unacknowledged-replaceOne-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-replaceOne-hint-clientError.yml new file mode 100644 index 0000000000..710cd424b1 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/unacknowledged-updateMany-hint-clientError.json b/test/spec/crud/unified/unacknowledged-updateMany-hint-clientError.json new file mode 100644 index 0000000000..6199dfa2be --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/unacknowledged-updateMany-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-updateMany-hint-clientError.yml new file mode 100644 index 0000000000..1594c7cd44 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/unacknowledged-updateOne-hint-clientError.json b/test/spec/crud/unified/unacknowledged-updateOne-hint-clientError.json new file mode 100644 index 0000000000..3828a9e8df --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/unacknowledged-updateOne-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-updateOne-hint-clientError.yml new file mode 100644 index 0000000000..49126ea006 --- /dev/null +++ b/test/spec/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/test/spec/crud/v2/updateMany-hint-clientError.json b/test/spec/crud/unified/updateMany-hint-clientError.json similarity index 50% rename from test/spec/crud/v2/updateMany-hint-clientError.json rename to test/spec/crud/unified/updateMany-hint-clientError.json index 44ebddc53d..5da878e293 100644 --- a/test/spec/crud/v2/updateMany-hint-clientError.json +++ b/test/spec/crud/unified/updateMany-hint-clientError.json @@ -1,30 +1,61 @@ { - "runOn": [ + "description": "updateMany-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ { "maxServerVersion": "3.3.99" } ], - "data": [ + "createEntities": [ { - "_id": 1, - "x": 11 + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } }, { - "_id": 2, - "x": 22 + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } }, { - "_id": 3, - "x": 33 + "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 + } + ] } ], - "collection_name": "test_updatemany_hint", "tests": [ { "description": "UpdateMany with hint string unsupported (client-side error)", "operations": [ { - "object": "collection", + "object": "collection0", "name": "updateMany", "arguments": { "filter": { @@ -39,13 +70,22 @@ }, "hint": "_id_" }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -60,13 +100,13 @@ } ] } - } + ] }, { "description": "UpdateMany with hint document unsupported (client-side error)", "operations": [ { - "object": "collection", + "object": "collection0", "name": "updateMany", "arguments": { "filter": { @@ -83,13 +123,22 @@ "_id": 1 } }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -104,7 +153,7 @@ } ] } - } + ] } ] } diff --git a/test/spec/crud/unified/updateMany-hint-clientError.yml b/test/spec/crud/unified/updateMany-hint-clientError.yml new file mode 100644 index 0000000000..9734078ce3 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/updateMany-hint-serverError.json b/test/spec/crud/unified/updateMany-hint-serverError.json new file mode 100644 index 0000000000..c81f36b13c --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/updateMany-hint-serverError.yml b/test/spec/crud/unified/updateMany-hint-serverError.yml new file mode 100644 index 0000000000..9e392c266d --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/updateMany-hint.json b/test/spec/crud/unified/updateMany-hint.json new file mode 100644 index 0000000000..929be52994 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/updateMany-hint.yml b/test/spec/crud/unified/updateMany-hint.yml new file mode 100644 index 0000000000..7ddb3a7b11 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/updateMany-validation.json b/test/spec/crud/unified/updateMany-validation.json new file mode 100644 index 0000000000..e3e46a1384 --- /dev/null +++ b/test/spec/crud/unified/updateMany-validation.json @@ -0,0 +1,98 @@ +{ + "description": "updateMany-validation", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "UpdateMany requires atomic modifiers", + "operations": [ + { + "name": "updateMany", + "object": "collection0", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "x": 44 + } + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/updateMany-validation.yml b/test/spec/crud/unified/updateMany-validation.yml new file mode 100644 index 0000000000..4e86eff1f3 --- /dev/null +++ b/test/spec/crud/unified/updateMany-validation.yml @@ -0,0 +1,39 @@ +description: "updateMany-validation" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name crud-tests + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: &initialData + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + +tests: + - description: "UpdateMany requires atomic modifiers" + operations: + - name: updateMany + object: *collection0 + arguments: + filter: { _id: { $gt: 1 } } + update: { x: 44 } + expectError: + isClientError: true + expectEvents: + - client: *client0 + events: [] + outcome: *initialData diff --git a/test/spec/crud/unified/updateOne-hint-clientError.json b/test/spec/crud/unified/updateOne-hint-clientError.json new file mode 100644 index 0000000000..d4f1a53430 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/updateOne-hint-clientError.yml b/test/spec/crud/unified/updateOne-hint-clientError.yml new file mode 100644 index 0000000000..87b4444c3a --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/updateOne-hint-serverError.json b/test/spec/crud/unified/updateOne-hint-serverError.json new file mode 100644 index 0000000000..05fb033319 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/updateOne-hint-serverError.yml b/test/spec/crud/unified/updateOne-hint-serverError.yml new file mode 100644 index 0000000000..f95c2b3217 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/updateOne-hint.json b/test/spec/crud/unified/updateOne-hint.json new file mode 100644 index 0000000000..484e00757d --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/updateOne-hint.yml b/test/spec/crud/unified/updateOne-hint.yml new file mode 100644 index 0000000000..55193582fb --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/updateOne-validation.json b/test/spec/crud/unified/updateOne-validation.json new file mode 100644 index 0000000000..1464642c59 --- /dev/null +++ b/test/spec/crud/unified/updateOne-validation.json @@ -0,0 +1,80 @@ +{ + "description": "updateOne-validation", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ], + "tests": [ + { + "description": "UpdateOne requires atomic modifiers", + "operations": [ + { + "name": "updateOne", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "x": 22 + } + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/updateOne-validation.yml b/test/spec/crud/unified/updateOne-validation.yml new file mode 100644 index 0000000000..b6f49a6568 --- /dev/null +++ b/test/spec/crud/unified/updateOne-validation.yml @@ -0,0 +1,37 @@ +description: "updateOne-validation" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name crud-tests + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: &initialData + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + +tests: + - description: "UpdateOne requires atomic modifiers" + operations: + - name: updateOne + object: *collection0 + arguments: + filter: { _id: 1 } + update: { x: 22 } + expectError: + isClientError: true + expectEvents: + - client: *client0 + events: [] + outcome: *initialData diff --git a/test/spec/crud/unified/updateWithPipelines.json b/test/spec/crud/unified/updateWithPipelines.json new file mode 100644 index 0000000000..164f2f6a19 --- /dev/null +++ b/test/spec/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/test/spec/crud/unified/updateWithPipelines.yml b/test/spec/crud/unified/updateWithPipelines.yml new file mode 100644 index 0000000000..4984dba24f --- /dev/null +++ b/test/spec/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 diff --git a/test/spec/crud/v1/read/aggregate-collation.json b/test/spec/crud/v1/read/aggregate-collation.json index 85662a442f..d958e447bf 100644 --- a/test/spec/crud/v1/read/aggregate-collation.json +++ b/test/spec/crud/v1/read/aggregate-collation.json @@ -6,6 +6,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "Aggregate with collation", diff --git a/test/spec/crud/v1/read/aggregate-collation.yml b/test/spec/crud/v1/read/aggregate-collation.yml index d526db6d12..24cafd24bf 100644 --- a/test/spec/crud/v1/read/aggregate-collation.yml +++ b/test/spec/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/test/spec/crud/v1/read/aggregate-out.json b/test/spec/crud/v1/read/aggregate-out.json index 4e33f9288f..c195e163e0 100644 --- a/test/spec/crud/v1/read/aggregate-out.json +++ b/test/spec/crud/v1/read/aggregate-out.json @@ -14,6 +14,7 @@ } ], "minServerVersion": "2.6", + "serverless": "forbid", "tests": [ { "description": "Aggregate with $out", diff --git a/test/spec/crud/v1/read/aggregate-out.yml b/test/spec/crud/v1/read/aggregate-out.yml index 893b7fe44b..d6688dd08d 100644 --- a/test/spec/crud/v1/read/aggregate-out.yml +++ b/test/spec/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/test/spec/crud/v1/read/count-collation.json b/test/spec/crud/v1/read/count-collation.json index 6f75282fe0..7d61508493 100644 --- a/test/spec/crud/v1/read/count-collation.json +++ b/test/spec/crud/v1/read/count-collation.json @@ -6,6 +6,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "Count documents with collation", diff --git a/test/spec/crud/v1/read/count-collation.yml b/test/spec/crud/v1/read/count-collation.yml index a463a7aa03..02da74c6b0 100644 --- a/test/spec/crud/v1/read/count-collation.yml +++ b/test/spec/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/test/spec/crud/v1/read/distinct-collation.json b/test/spec/crud/v1/read/distinct-collation.json index 0af0c67cb7..984991a43b 100644 --- a/test/spec/crud/v1/read/distinct-collation.json +++ b/test/spec/crud/v1/read/distinct-collation.json @@ -10,6 +10,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "Distinct with a collation", diff --git a/test/spec/crud/v1/read/distinct-collation.yml b/test/spec/crud/v1/read/distinct-collation.yml index 08bd6a9292..33b57d9927 100644 --- a/test/spec/crud/v1/read/distinct-collation.yml +++ b/test/spec/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/test/spec/crud/v1/read/find-collation.json b/test/spec/crud/v1/read/find-collation.json index 53d0e94900..4e56c05253 100644 --- a/test/spec/crud/v1/read/find-collation.json +++ b/test/spec/crud/v1/read/find-collation.json @@ -6,6 +6,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "Find with a collation", diff --git a/test/spec/crud/v1/read/find-collation.yml b/test/spec/crud/v1/read/find-collation.yml index a014dc2510..baac5add49 100644 --- a/test/spec/crud/v1/read/find-collation.yml +++ b/test/spec/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/test/spec/crud/v1/write/bulkWrite-collation.json b/test/spec/crud/v1/write/bulkWrite-collation.json index 8e9d1bcb1a..bc90aa8172 100644 --- a/test/spec/crud/v1/write/bulkWrite-collation.json +++ b/test/spec/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/test/spec/crud/v1/write/bulkWrite-collation.yml b/test/spec/crud/v1/write/bulkWrite-collation.yml index 217c691166..5aff22eed1 100644 --- a/test/spec/crud/v1/write/bulkWrite-collation.yml +++ b/test/spec/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/test/spec/crud/v1/write/deleteMany-collation.json b/test/spec/crud/v1/write/deleteMany-collation.json index d17bf3bcb9..fce75e488a 100644 --- a/test/spec/crud/v1/write/deleteMany-collation.json +++ b/test/spec/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/test/spec/crud/v1/write/deleteMany-collation.yml b/test/spec/crud/v1/write/deleteMany-collation.yml index daca5dd4c2..2b0ef9db94 100644 --- a/test/spec/crud/v1/write/deleteMany-collation.yml +++ b/test/spec/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/test/spec/crud/v1/write/deleteOne-collation.json b/test/spec/crud/v1/write/deleteOne-collation.json index 2f7f921130..9bcef411ef 100644 --- a/test/spec/crud/v1/write/deleteOne-collation.json +++ b/test/spec/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/test/spec/crud/v1/write/deleteOne-collation.yml b/test/spec/crud/v1/write/deleteOne-collation.yml index 321a148856..d37ecf76de 100644 --- a/test/spec/crud/v1/write/deleteOne-collation.yml +++ b/test/spec/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/test/spec/crud/v1/write/findOneAndDelete-collation.json b/test/spec/crud/v1/write/findOneAndDelete-collation.json index 1ff37d2e88..32480da842 100644 --- a/test/spec/crud/v1/write/findOneAndDelete-collation.json +++ b/test/spec/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/test/spec/crud/v1/write/findOneAndDelete-collation.yml b/test/spec/crud/v1/write/findOneAndDelete-collation.yml index d33741f573..5f13b7e5b7 100644 --- a/test/spec/crud/v1/write/findOneAndDelete-collation.yml +++ b/test/spec/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/test/spec/crud/v1/write/findOneAndReplace-collation.json b/test/spec/crud/v1/write/findOneAndReplace-collation.json index babb2f7c11..9b3c25005b 100644 --- a/test/spec/crud/v1/write/findOneAndReplace-collation.json +++ b/test/spec/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/test/spec/crud/v1/write/findOneAndReplace-collation.yml b/test/spec/crud/v1/write/findOneAndReplace-collation.yml index 040661d752..206ac829c8 100644 --- a/test/spec/crud/v1/write/findOneAndReplace-collation.yml +++ b/test/spec/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/test/spec/crud/v1/write/findOneAndUpdate-collation.json b/test/spec/crud/v1/write/findOneAndUpdate-collation.json index 04c1fe73ec..8abab7bd6b 100644 --- a/test/spec/crud/v1/write/findOneAndUpdate-collation.json +++ b/test/spec/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/test/spec/crud/v1/write/findOneAndUpdate-collation.yml b/test/spec/crud/v1/write/findOneAndUpdate-collation.yml index 201f2751c3..1c50e86be8 100644 --- a/test/spec/crud/v1/write/findOneAndUpdate-collation.yml +++ b/test/spec/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/test/spec/crud/v1/write/replaceOne-collation.json b/test/spec/crud/v1/write/replaceOne-collation.json index a668fe7383..fa4cbe9970 100644 --- a/test/spec/crud/v1/write/replaceOne-collation.json +++ b/test/spec/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/test/spec/crud/v1/write/replaceOne-collation.yml b/test/spec/crud/v1/write/replaceOne-collation.yml index 6861092bbb..715cdce844 100644 --- a/test/spec/crud/v1/write/replaceOne-collation.yml +++ b/test/spec/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/test/spec/crud/v1/write/updateMany-collation.json b/test/spec/crud/v1/write/updateMany-collation.json index 3cb49f2298..8becfd806b 100644 --- a/test/spec/crud/v1/write/updateMany-collation.json +++ b/test/spec/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/test/spec/crud/v1/write/updateMany-collation.yml b/test/spec/crud/v1/write/updateMany-collation.yml index 2d48a9dcfe..5a7048f09a 100644 --- a/test/spec/crud/v1/write/updateMany-collation.yml +++ b/test/spec/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/test/spec/crud/v1/write/updateOne-collation.json b/test/spec/crud/v1/write/updateOne-collation.json index c49112d519..3afdb83e0f 100644 --- a/test/spec/crud/v1/write/updateOne-collation.json +++ b/test/spec/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/test/spec/crud/v1/write/updateOne-collation.yml b/test/spec/crud/v1/write/updateOne-collation.yml index 468e946742..0132152b09 100644 --- a/test/spec/crud/v1/write/updateOne-collation.yml +++ b/test/spec/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/test/spec/crud/v2/aggregate-merge.json b/test/spec/crud/v2/aggregate-merge.json deleted file mode 100644 index c61736a0bb..0000000000 --- a/test/spec/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/test/spec/crud/v2/aggregate-merge.yml b/test/spec/crud/v2/aggregate-merge.yml deleted file mode 100644 index 5bc5c68acd..0000000000 --- a/test/spec/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/test/spec/crud/v2/aggregate-out-readConcern.json b/test/spec/crud/v2/aggregate-out-readConcern.json deleted file mode 100644 index c39ee0e281..0000000000 --- a/test/spec/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/test/spec/crud/v2/aggregate-out-readConcern.yml b/test/spec/crud/v2/aggregate-out-readConcern.yml deleted file mode 100644 index 0a864f05e7..0000000000 --- a/test/spec/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/test/spec/crud/v2/bulkWrite-arrayFilters-clientError.yml b/test/spec/crud/v2/bulkWrite-arrayFilters-clientError.yml deleted file mode 100644 index 0421ab33e6..0000000000 --- a/test/spec/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/test/spec/crud/v2/bulkWrite-arrayFilters.json b/test/spec/crud/v2/bulkWrite-arrayFilters.json deleted file mode 100644 index 2d3ce96de1..0000000000 --- a/test/spec/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/test/spec/crud/v2/bulkWrite-arrayFilters.yml b/test/spec/crud/v2/bulkWrite-arrayFilters.yml deleted file mode 100644 index b3e32e6aa4..0000000000 --- a/test/spec/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/test/spec/crud/v2/bulkWrite-delete-hint-clientError.yml b/test/spec/crud/v2/bulkWrite-delete-hint-clientError.yml deleted file mode 100644 index bbd1a0be51..0000000000 --- a/test/spec/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/test/spec/crud/v2/bulkWrite-delete-hint-serverError.json b/test/spec/crud/v2/bulkWrite-delete-hint-serverError.json deleted file mode 100644 index c68973b0f6..0000000000 --- a/test/spec/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/test/spec/crud/v2/bulkWrite-delete-hint-serverError.yml b/test/spec/crud/v2/bulkWrite-delete-hint-serverError.yml deleted file mode 100644 index 72d32dd424..0000000000 --- a/test/spec/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/test/spec/crud/v2/bulkWrite-delete-hint.json b/test/spec/crud/v2/bulkWrite-delete-hint.json deleted file mode 100644 index ece3238fc3..0000000000 --- a/test/spec/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/test/spec/crud/v2/bulkWrite-delete-hint.yml b/test/spec/crud/v2/bulkWrite-delete-hint.yml deleted file mode 100644 index 671c531e71..0000000000 --- a/test/spec/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/test/spec/crud/v2/bulkWrite-update-hint-clientError.yml b/test/spec/crud/v2/bulkWrite-update-hint-clientError.yml deleted file mode 100644 index 9b92b63b84..0000000000 --- a/test/spec/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/test/spec/crud/v2/bulkWrite-update-hint-serverError.json b/test/spec/crud/v2/bulkWrite-update-hint-serverError.json deleted file mode 100644 index e8b96fffeb..0000000000 --- a/test/spec/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/test/spec/crud/v2/bulkWrite-update-hint-serverError.yml b/test/spec/crud/v2/bulkWrite-update-hint-serverError.yml deleted file mode 100644 index 8412b6dd94..0000000000 --- a/test/spec/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/test/spec/crud/v2/bulkWrite-update-hint.json b/test/spec/crud/v2/bulkWrite-update-hint.json deleted file mode 100644 index 15e169f76c..0000000000 --- a/test/spec/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/test/spec/crud/v2/bulkWrite-update-hint.yml b/test/spec/crud/v2/bulkWrite-update-hint.yml deleted file mode 100644 index 0d60a56b6f..0000000000 --- a/test/spec/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/test/spec/crud/v2/bulkWrite-update-validation.yml b/test/spec/crud/v2/bulkWrite-update-validation.yml deleted file mode 100644 index ac11f18b22..0000000000 --- a/test/spec/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/test/spec/crud/v2/db-aggregate.yml b/test/spec/crud/v2/db-aggregate.yml deleted file mode 100644 index e9a814858d..0000000000 --- a/test/spec/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/test/spec/crud/v2/deleteMany-hint-clientError.json b/test/spec/crud/v2/deleteMany-hint-clientError.json deleted file mode 100644 index 3a0d02566b..0000000000 --- a/test/spec/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/test/spec/crud/v2/deleteMany-hint-clientError.yml b/test/spec/crud/v2/deleteMany-hint-clientError.yml deleted file mode 100644 index fc5f555478..0000000000 --- a/test/spec/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/test/spec/crud/v2/deleteMany-hint-serverError.json b/test/spec/crud/v2/deleteMany-hint-serverError.json deleted file mode 100644 index 5829e86df8..0000000000 --- a/test/spec/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/test/spec/crud/v2/deleteMany-hint-serverError.yml b/test/spec/crud/v2/deleteMany-hint-serverError.yml deleted file mode 100644 index b21736091a..0000000000 --- a/test/spec/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/test/spec/crud/v2/deleteMany-hint.json b/test/spec/crud/v2/deleteMany-hint.json deleted file mode 100644 index 51ee386066..0000000000 --- a/test/spec/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/test/spec/crud/v2/deleteMany-hint.yml b/test/spec/crud/v2/deleteMany-hint.yml deleted file mode 100644 index d1d25cff1a..0000000000 --- a/test/spec/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/test/spec/crud/v2/deleteOne-hint-clientError.json b/test/spec/crud/v2/deleteOne-hint-clientError.json deleted file mode 100644 index 97f8ec4924..0000000000 --- a/test/spec/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/test/spec/crud/v2/deleteOne-hint-clientError.yml b/test/spec/crud/v2/deleteOne-hint-clientError.yml deleted file mode 100644 index cb65d5ff0d..0000000000 --- a/test/spec/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/test/spec/crud/v2/deleteOne-hint-serverError.json b/test/spec/crud/v2/deleteOne-hint-serverError.json deleted file mode 100644 index 3cf9400a88..0000000000 --- a/test/spec/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/test/spec/crud/v2/deleteOne-hint-serverError.yml b/test/spec/crud/v2/deleteOne-hint-serverError.yml deleted file mode 100644 index b0158fa043..0000000000 --- a/test/spec/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/test/spec/crud/v2/deleteOne-hint.json b/test/spec/crud/v2/deleteOne-hint.json deleted file mode 100644 index ec8e7715a2..0000000000 --- a/test/spec/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/test/spec/crud/v2/deleteOne-hint.yml b/test/spec/crud/v2/deleteOne-hint.yml deleted file mode 100644 index 939ff9e064..0000000000 --- a/test/spec/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/test/spec/crud/v2/find-allowdiskuse-clientError.json b/test/spec/crud/v2/find-allowdiskuse-clientError.json deleted file mode 100644 index 5ea013966a..0000000000 --- a/test/spec/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/test/spec/crud/v2/find-allowdiskuse-clientError.yml b/test/spec/crud/v2/find-allowdiskuse-clientError.yml deleted file mode 100644 index d877b6259b..0000000000 --- a/test/spec/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/test/spec/crud/v2/find-allowdiskuse-serverError.json b/test/spec/crud/v2/find-allowdiskuse-serverError.json deleted file mode 100644 index 31aa50e951..0000000000 --- a/test/spec/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/test/spec/crud/v2/find-allowdiskuse-serverError.yml b/test/spec/crud/v2/find-allowdiskuse-serverError.yml deleted file mode 100644 index 729fbfd0b7..0000000000 --- a/test/spec/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/test/spec/crud/v2/find-allowdiskuse.json b/test/spec/crud/v2/find-allowdiskuse.json deleted file mode 100644 index b2862563b9..0000000000 --- a/test/spec/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/test/spec/crud/v2/find-allowdiskuse.yml b/test/spec/crud/v2/find-allowdiskuse.yml deleted file mode 100644 index adfc0000ea..0000000000 --- a/test/spec/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/test/spec/crud/v2/findOneAndDelete-hint-clientError.json b/test/spec/crud/v2/findOneAndDelete-hint-clientError.json deleted file mode 100644 index 262e78ce75..0000000000 --- a/test/spec/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/test/spec/crud/v2/findOneAndDelete-hint-clientError.yml b/test/spec/crud/v2/findOneAndDelete-hint-clientError.yml deleted file mode 100644 index 338faba9da..0000000000 --- a/test/spec/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/test/spec/crud/v2/findOneAndDelete-hint-serverError.json b/test/spec/crud/v2/findOneAndDelete-hint-serverError.json deleted file mode 100644 index 9412b36f23..0000000000 --- a/test/spec/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/test/spec/crud/v2/findOneAndDelete-hint-serverError.yml b/test/spec/crud/v2/findOneAndDelete-hint-serverError.yml deleted file mode 100644 index 305ea66eca..0000000000 --- a/test/spec/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/test/spec/crud/v2/findOneAndDelete-hint.json b/test/spec/crud/v2/findOneAndDelete-hint.json deleted file mode 100644 index fe8dcfa4c5..0000000000 --- a/test/spec/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/test/spec/crud/v2/findOneAndDelete-hint.yml b/test/spec/crud/v2/findOneAndDelete-hint.yml deleted file mode 100644 index 9ae087d11b..0000000000 --- a/test/spec/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/test/spec/crud/v2/findOneAndReplace-hint-clientError.json b/test/spec/crud/v2/findOneAndReplace-hint-clientError.json deleted file mode 100644 index 08fd4b3ecc..0000000000 --- a/test/spec/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/test/spec/crud/v2/findOneAndReplace-hint-clientError.yml b/test/spec/crud/v2/findOneAndReplace-hint-clientError.yml deleted file mode 100644 index f50782d338..0000000000 --- a/test/spec/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/test/spec/crud/v2/findOneAndReplace-hint-serverError.json b/test/spec/crud/v2/findOneAndReplace-hint-serverError.json deleted file mode 100644 index 6710e6a70e..0000000000 --- a/test/spec/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/test/spec/crud/v2/findOneAndReplace-hint-serverError.yml b/test/spec/crud/v2/findOneAndReplace-hint-serverError.yml deleted file mode 100644 index 41812658a1..0000000000 --- a/test/spec/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/test/spec/crud/v2/findOneAndReplace-hint.json b/test/spec/crud/v2/findOneAndReplace-hint.json deleted file mode 100644 index 263fdf9623..0000000000 --- a/test/spec/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/test/spec/crud/v2/findOneAndReplace-hint.yml b/test/spec/crud/v2/findOneAndReplace-hint.yml deleted file mode 100644 index b585dd867b..0000000000 --- a/test/spec/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/test/spec/crud/v2/findOneAndUpdate-hint-clientError.json b/test/spec/crud/v2/findOneAndUpdate-hint-clientError.json deleted file mode 100644 index 8cd5cddb51..0000000000 --- a/test/spec/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/test/spec/crud/v2/findOneAndUpdate-hint-clientError.yml b/test/spec/crud/v2/findOneAndUpdate-hint-clientError.yml deleted file mode 100644 index aec3e244d2..0000000000 --- a/test/spec/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/test/spec/crud/v2/findOneAndUpdate-hint-serverError.json b/test/spec/crud/v2/findOneAndUpdate-hint-serverError.json deleted file mode 100644 index 1f4b2bda8b..0000000000 --- a/test/spec/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/test/spec/crud/v2/findOneAndUpdate-hint-serverError.yml b/test/spec/crud/v2/findOneAndUpdate-hint-serverError.yml deleted file mode 100644 index 06f788a62b..0000000000 --- a/test/spec/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/test/spec/crud/v2/findOneAndUpdate-hint.json b/test/spec/crud/v2/findOneAndUpdate-hint.json deleted file mode 100644 index 451eecc013..0000000000 --- a/test/spec/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/test/spec/crud/v2/findOneAndUpdate-hint.yml b/test/spec/crud/v2/findOneAndUpdate-hint.yml deleted file mode 100644 index 36b169c2a1..0000000000 --- a/test/spec/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/test/spec/crud/v2/replaceOne-hint.json b/test/spec/crud/v2/replaceOne-hint.json deleted file mode 100644 index de4aa4d02f..0000000000 --- a/test/spec/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/test/spec/crud/v2/replaceOne-hint.yml b/test/spec/crud/v2/replaceOne-hint.yml deleted file mode 100644 index 8b418d1202..0000000000 --- a/test/spec/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/test/spec/crud/v2/replaceOne-validation.json b/test/spec/crud/v2/replaceOne-validation.json deleted file mode 100644 index 2de4a6728b..0000000000 --- a/test/spec/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/test/spec/crud/v2/replaceOne-validation.yml b/test/spec/crud/v2/replaceOne-validation.yml deleted file mode 100644 index 60ac9894c4..0000000000 --- a/test/spec/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/test/spec/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.yml deleted file mode 100644 index 7130aa1cf0..0000000000 --- a/test/spec/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/test/spec/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.yml deleted file mode 100644 index 2aecaa3099..0000000000 --- a/test/spec/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/test/spec/crud/v2/unacknowledged-deleteMany-hint-clientError.json b/test/spec/crud/v2/unacknowledged-deleteMany-hint-clientError.json deleted file mode 100644 index 532f4282a9..0000000000 --- a/test/spec/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/test/spec/crud/v2/unacknowledged-deleteMany-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-deleteMany-hint-clientError.yml deleted file mode 100644 index 4f08b361db..0000000000 --- a/test/spec/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/test/spec/crud/v2/unacknowledged-deleteOne-hint-clientError.json b/test/spec/crud/v2/unacknowledged-deleteOne-hint-clientError.json deleted file mode 100644 index ff3f05ea3e..0000000000 --- a/test/spec/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/test/spec/crud/v2/unacknowledged-deleteOne-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-deleteOne-hint-clientError.yml deleted file mode 100644 index 1084235dd4..0000000000 --- a/test/spec/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/test/spec/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.json b/test/spec/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.json deleted file mode 100644 index 076978874d..0000000000 --- a/test/spec/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/test/spec/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.yml deleted file mode 100644 index fda6d85e12..0000000000 --- a/test/spec/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/test/spec/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.json b/test/spec/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.json deleted file mode 100644 index 38fbc817be..0000000000 --- a/test/spec/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/test/spec/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.yml deleted file mode 100644 index 628aef5364..0000000000 --- a/test/spec/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/test/spec/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.json b/test/spec/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.json deleted file mode 100644 index 615b4c0e63..0000000000 --- a/test/spec/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/test/spec/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.yml deleted file mode 100644 index 3aa2ac044a..0000000000 --- a/test/spec/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/test/spec/crud/v2/unacknowledged-replaceOne-hint-clientError.json b/test/spec/crud/v2/unacknowledged-replaceOne-hint-clientError.json deleted file mode 100644 index c4add73c2d..0000000000 --- a/test/spec/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/test/spec/crud/v2/unacknowledged-replaceOne-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-replaceOne-hint-clientError.yml deleted file mode 100644 index 5d5cbeac1d..0000000000 --- a/test/spec/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/test/spec/crud/v2/unacknowledged-updateMany-hint-clientError.json b/test/spec/crud/v2/unacknowledged-updateMany-hint-clientError.json deleted file mode 100644 index eaf3efd1cf..0000000000 --- a/test/spec/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/test/spec/crud/v2/unacknowledged-updateMany-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-updateMany-hint-clientError.yml deleted file mode 100644 index aeec51b92e..0000000000 --- a/test/spec/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/test/spec/crud/v2/unacknowledged-updateOne-hint-clientError.json b/test/spec/crud/v2/unacknowledged-updateOne-hint-clientError.json deleted file mode 100644 index 1f8f738012..0000000000 --- a/test/spec/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/test/spec/crud/v2/unacknowledged-updateOne-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-updateOne-hint-clientError.yml deleted file mode 100644 index bdd32aea37..0000000000 --- a/test/spec/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/test/spec/crud/v2/updateMany-hint-clientError.yml b/test/spec/crud/v2/updateMany-hint-clientError.yml deleted file mode 100644 index c6a06ef5ba..0000000000 --- a/test/spec/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/test/spec/crud/v2/updateMany-hint-serverError.json b/test/spec/crud/v2/updateMany-hint-serverError.json deleted file mode 100644 index 86f21246e9..0000000000 --- a/test/spec/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/test/spec/crud/v2/updateMany-hint-serverError.yml b/test/spec/crud/v2/updateMany-hint-serverError.yml deleted file mode 100644 index 245dbc7258..0000000000 --- a/test/spec/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/test/spec/crud/v2/updateMany-hint.json b/test/spec/crud/v2/updateMany-hint.json deleted file mode 100644 index 489348917f..0000000000 --- a/test/spec/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/test/spec/crud/v2/updateMany-hint.yml b/test/spec/crud/v2/updateMany-hint.yml deleted file mode 100644 index 57067f0778..0000000000 --- a/test/spec/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/test/spec/crud/v2/updateMany-validation.json b/test/spec/crud/v2/updateMany-validation.json deleted file mode 100644 index a85ccfa86e..0000000000 --- a/test/spec/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/test/spec/crud/v2/updateMany-validation.yml b/test/spec/crud/v2/updateMany-validation.yml deleted file mode 100644 index 982df82625..0000000000 --- a/test/spec/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/test/spec/crud/v2/updateOne-hint-clientError.json b/test/spec/crud/v2/updateOne-hint-clientError.json deleted file mode 100644 index 82bfe368c7..0000000000 --- a/test/spec/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/test/spec/crud/v2/updateOne-hint-clientError.yml b/test/spec/crud/v2/updateOne-hint-clientError.yml deleted file mode 100644 index 41e42ebf2f..0000000000 --- a/test/spec/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/test/spec/crud/v2/updateOne-hint-serverError.json b/test/spec/crud/v2/updateOne-hint-serverError.json deleted file mode 100644 index 8e8037eb8c..0000000000 --- a/test/spec/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/test/spec/crud/v2/updateOne-hint-serverError.yml b/test/spec/crud/v2/updateOne-hint-serverError.yml deleted file mode 100644 index 73b1151973..0000000000 --- a/test/spec/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/test/spec/crud/v2/updateOne-hint.json b/test/spec/crud/v2/updateOne-hint.json deleted file mode 100644 index 43f76da498..0000000000 --- a/test/spec/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/test/spec/crud/v2/updateOne-hint.yml b/test/spec/crud/v2/updateOne-hint.yml deleted file mode 100644 index cb86da9475..0000000000 --- a/test/spec/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/test/spec/crud/v2/updateOne-validation.json b/test/spec/crud/v2/updateOne-validation.json deleted file mode 100644 index 6c919f5ea0..0000000000 --- a/test/spec/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/test/spec/crud/v2/updateOne-validation.yml b/test/spec/crud/v2/updateOne-validation.yml deleted file mode 100644 index 290952ca50..0000000000 --- a/test/spec/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/test/spec/crud/v2/updateWithPipelines.json b/test/spec/crud/v2/updateWithPipelines.json deleted file mode 100644 index a310f2825f..0000000000 --- a/test/spec/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/test/spec/crud/v2/updateWithPipelines.yml b/test/spec/crud/v2/updateWithPipelines.yml deleted file mode 100644 index 08eef7b0b3..0000000000 --- a/test/spec/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/test/spec/retryable-reads/aggregate-serverErrors.json b/test/spec/retryable-reads/aggregate-serverErrors.json index 67636d5b7d..1155f808dc 100644 --- a/test/spec/retryable-reads/aggregate-serverErrors.json +++ b/test/spec/retryable-reads/aggregate-serverErrors.json @@ -219,7 +219,7 @@ ] }, { - "description": "Aggregate succeeds after NotMaster", + "description": "Aggregate succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -312,7 +312,7 @@ ] }, { - "description": "Aggregate succeeds after NotMasterNoSlaveOk", + "description": "Aggregate succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -405,7 +405,7 @@ ] }, { - "description": "Aggregate succeeds after NotMasterOrSecondary", + "description": "Aggregate succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -1056,7 +1056,7 @@ ] }, { - "description": "Aggregate fails after two NotMaster errors", + "description": "Aggregate fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -1140,7 +1140,7 @@ ] }, { - "description": "Aggregate fails after NotMaster when retryReads is false", + "description": "Aggregate fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/aggregate-serverErrors.yml b/test/spec/retryable-reads/aggregate-serverErrors.yml index b64b7b3adc..bf9fc01892 100644 --- a/test/spec/retryable-reads/aggregate-serverErrors.yml +++ b/test/spec/retryable-reads/aggregate-serverErrors.yml @@ -52,7 +52,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Aggregate succeeds after NotMaster" + description: "Aggregate succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 10107 } @@ -61,7 +61,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Aggregate succeeds after NotMasterNoSlaveOk" + description: "Aggregate succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13435 } @@ -70,7 +70,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Aggregate succeeds after NotMasterOrSecondary" + description: "Aggregate succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13436 } @@ -133,7 +133,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Aggregate fails after two NotMaster errors" + description: "Aggregate fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -146,7 +146,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Aggregate fails after NotMaster when retryReads is false" + description: "Aggregate fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/aggregate.yml b/test/spec/retryable-reads/aggregate.yml index c8443e3fbf..de9c0d7069 100644 --- a/test/spec/retryable-reads/aggregate.yml +++ b/test/spec/retryable-reads/aggregate.yml @@ -84,4 +84,4 @@ tests: aggregate: *collection_name pipeline: [{$match: {_id: {$gt: 1}}}, {$sort: {x: 1}}, {$out: 'output-collection'}] command_name: aggregate - database_name: *database_name \ No newline at end of file + database_name: *database_name diff --git a/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.json b/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.json index 17bc53fd4b..73dbfee916 100644 --- a/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.json +++ b/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.json @@ -11,7 +11,8 @@ "topology": [ "sharded", "load-balanced" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", @@ -142,7 +143,7 @@ ] }, { - "description": "client.watch succeeds after NotMaster", + "description": "client.watch succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -197,7 +198,7 @@ ] }, { - "description": "client.watch succeeds after NotMasterNoSlaveOk", + "description": "client.watch succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -252,7 +253,7 @@ ] }, { - "description": "client.watch succeeds after NotMasterOrSecondary", + "description": "client.watch succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -637,7 +638,7 @@ ] }, { - "description": "client.watch fails after two NotMaster errors", + "description": "client.watch fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -693,7 +694,7 @@ ] }, { - "description": "client.watch fails after NotMaster when retryReads is false", + "description": "client.watch fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.yml b/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.yml index 61fe2358a1..a1f1069643 100644 --- a/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.yml +++ b/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.yml @@ -5,6 +5,7 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded", "load-balanced"] + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" @@ -44,7 +45,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "client.watch succeeds after NotMaster" + description: "client.watch succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 10107 } @@ -53,7 +54,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "client.watch succeeds after NotMasterNoSlaveOk" + description: "client.watch succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13435 } @@ -62,7 +63,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "client.watch succeeds after NotMasterOrSecondary" + description: "client.watch succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13436 } @@ -125,7 +126,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "client.watch fails after two NotMaster errors" + description: "client.watch fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -138,7 +139,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "client.watch fails after NotMaster when retryReads is false" + description: "client.watch fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/changeStreams-client.watch.json b/test/spec/retryable-reads/changeStreams-client.watch.json index 9a07053f84..30a53037ad 100644 --- a/test/spec/retryable-reads/changeStreams-client.watch.json +++ b/test/spec/retryable-reads/changeStreams-client.watch.json @@ -11,7 +11,8 @@ "topology": [ "sharded", "load-balanced" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", diff --git a/test/spec/retryable-reads/changeStreams-client.watch.yml b/test/spec/retryable-reads/changeStreams-client.watch.yml index 5550bfa100..ea7f7e069a 100644 --- a/test/spec/retryable-reads/changeStreams-client.watch.yml +++ b/test/spec/retryable-reads/changeStreams-client.watch.yml @@ -5,6 +5,7 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded", "load-balanced"] + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.json b/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.json index 5b405e3feb..77b3af04f4 100644 --- a/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.json +++ b/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.json @@ -11,7 +11,8 @@ "topology": [ "sharded", "load-balanced" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", @@ -134,7 +135,7 @@ ] }, { - "description": "db.coll.watch succeeds after NotMaster", + "description": "db.coll.watch succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -185,7 +186,7 @@ ] }, { - "description": "db.coll.watch succeeds after NotMasterNoSlaveOk", + "description": "db.coll.watch succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -236,7 +237,7 @@ ] }, { - "description": "db.coll.watch succeeds after NotMasterOrSecondary", + "description": "db.coll.watch succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -593,7 +594,7 @@ ] }, { - "description": "db.coll.watch fails after two NotMaster errors", + "description": "db.coll.watch fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -645,7 +646,7 @@ ] }, { - "description": "db.coll.watch fails after NotMaster when retryReads is false", + "description": "db.coll.watch fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.yml b/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.yml index 37ad0ae00d..4e4bb4a1b7 100644 --- a/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.yml +++ b/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.yml @@ -5,6 +5,7 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded", "load-balanced"] + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" @@ -44,7 +45,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.coll.watch succeeds after NotMaster" + description: "db.coll.watch succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 10107 } @@ -53,7 +54,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.coll.watch succeeds after NotMasterNoSlaveOk" + description: "db.coll.watch succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13435 } @@ -62,7 +63,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.coll.watch succeeds after NotMasterOrSecondary" + description: "db.coll.watch succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13436 } @@ -125,7 +126,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.coll.watch fails after two NotMaster errors" + description: "db.coll.watch fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -138,7 +139,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.coll.watch fails after NotMaster when retryReads is false" + description: "db.coll.watch fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/changeStreams-db.coll.watch.json b/test/spec/retryable-reads/changeStreams-db.coll.watch.json index 5e69d9da26..27f6105a4b 100644 --- a/test/spec/retryable-reads/changeStreams-db.coll.watch.json +++ b/test/spec/retryable-reads/changeStreams-db.coll.watch.json @@ -11,7 +11,8 @@ "topology": [ "sharded", "load-balanced" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", diff --git a/test/spec/retryable-reads/changeStreams-db.coll.watch.yml b/test/spec/retryable-reads/changeStreams-db.coll.watch.yml index 50258cca2e..c8334b1a99 100644 --- a/test/spec/retryable-reads/changeStreams-db.coll.watch.yml +++ b/test/spec/retryable-reads/changeStreams-db.coll.watch.yml @@ -5,6 +5,7 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded", "load-balanced"] + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.json b/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.json index 56fa662901..7a87534508 100644 --- a/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.json +++ b/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.json @@ -11,7 +11,8 @@ "topology": [ "sharded", "load-balanced" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", @@ -134,7 +135,7 @@ ] }, { - "description": "db.watch succeeds after NotMaster", + "description": "db.watch succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -185,7 +186,7 @@ ] }, { - "description": "db.watch succeeds after NotMasterNoSlaveOk", + "description": "db.watch succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -236,7 +237,7 @@ ] }, { - "description": "db.watch succeeds after NotMasterOrSecondary", + "description": "db.watch succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -593,7 +594,7 @@ ] }, { - "description": "db.watch fails after two NotMaster errors", + "description": "db.watch fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -645,7 +646,7 @@ ] }, { - "description": "db.watch fails after NotMaster when retryReads is false", + "description": "db.watch fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.yml b/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.yml index 7ee9df0743..a527935bae 100644 --- a/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.yml +++ b/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.yml @@ -5,6 +5,7 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded", "load-balanced"] + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" @@ -44,7 +45,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.watch succeeds after NotMaster" + description: "db.watch succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 10107 } @@ -53,7 +54,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.watch succeeds after NotMasterNoSlaveOk" + description: "db.watch succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13435 } @@ -62,7 +63,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.watch succeeds after NotMasterOrSecondary" + description: "db.watch succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13436 } @@ -125,7 +126,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.watch fails after two NotMaster errors" + description: "db.watch fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -138,7 +139,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.watch fails after NotMaster when retryReads is false" + description: "db.watch fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/changeStreams-db.watch.json b/test/spec/retryable-reads/changeStreams-db.watch.json index 1777e1832e..e6b0b9b781 100644 --- a/test/spec/retryable-reads/changeStreams-db.watch.json +++ b/test/spec/retryable-reads/changeStreams-db.watch.json @@ -11,7 +11,8 @@ "topology": [ "sharded", "load-balanced" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", diff --git a/test/spec/retryable-reads/changeStreams-db.watch.yml b/test/spec/retryable-reads/changeStreams-db.watch.yml index e46c514169..e2ceacbb66 100644 --- a/test/spec/retryable-reads/changeStreams-db.watch.yml +++ b/test/spec/retryable-reads/changeStreams-db.watch.yml @@ -5,6 +5,7 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded", "load-balanced"] + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/count-serverErrors.json b/test/spec/retryable-reads/count-serverErrors.json index 565323640e..36a0c17cab 100644 --- a/test/spec/retryable-reads/count-serverErrors.json +++ b/test/spec/retryable-reads/count-serverErrors.json @@ -115,7 +115,7 @@ ] }, { - "description": "Count succeeds after NotMaster", + "description": "Count succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -158,7 +158,7 @@ ] }, { - "description": "Count succeeds after NotMasterNoSlaveOk", + "description": "Count succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -201,7 +201,7 @@ ] }, { - "description": "Count succeeds after NotMasterOrSecondary", + "description": "Count succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -502,7 +502,7 @@ ] }, { - "description": "Count fails after two NotMaster errors", + "description": "Count fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -545,7 +545,7 @@ ] }, { - "description": "Count fails after NotMaster when retryReads is false", + "description": "Count fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/count-serverErrors.yml b/test/spec/retryable-reads/count-serverErrors.yml index 4f7f5c9c94..48ceaea68b 100644 --- a/test/spec/retryable-reads/count-serverErrors.yml +++ b/test/spec/retryable-reads/count-serverErrors.yml @@ -44,7 +44,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Count succeeds after NotMaster" + description: "Count succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [count], errorCode: 10107 } @@ -53,7 +53,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Count succeeds after NotMasterNoSlaveOk" + description: "Count succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [count], errorCode: 13435 } @@ -62,7 +62,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Count succeeds after NotMasterOrSecondary" + description: "Count succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [count], errorCode: 13436 } @@ -125,7 +125,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Count fails after two NotMaster errors" + description: "Count fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -138,7 +138,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Count fails after NotMaster when retryReads is false" + description: "Count fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/countDocuments-serverErrors.json b/test/spec/retryable-reads/countDocuments-serverErrors.json index 107372ef30..782ea5e4f1 100644 --- a/test/spec/retryable-reads/countDocuments-serverErrors.json +++ b/test/spec/retryable-reads/countDocuments-serverErrors.json @@ -167,7 +167,7 @@ ] }, { - "description": "CountDocuments succeeds after NotMaster", + "description": "CountDocuments succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -236,7 +236,7 @@ ] }, { - "description": "CountDocuments succeeds after NotMasterNoSlaveOk", + "description": "CountDocuments succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -305,7 +305,7 @@ ] }, { - "description": "CountDocuments succeeds after NotMasterOrSecondary", + "description": "CountDocuments succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -788,7 +788,7 @@ ] }, { - "description": "CountDocuments fails after two NotMaster errors", + "description": "CountDocuments fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -857,7 +857,7 @@ ] }, { - "description": "CountDocuments fails after NotMaster when retryReads is false", + "description": "CountDocuments fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/countDocuments-serverErrors.yml b/test/spec/retryable-reads/countDocuments-serverErrors.yml index 6d5e309cf9..4ffb9a05b5 100644 --- a/test/spec/retryable-reads/countDocuments-serverErrors.yml +++ b/test/spec/retryable-reads/countDocuments-serverErrors.yml @@ -45,7 +45,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "CountDocuments succeeds after NotMaster" + description: "CountDocuments succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 10107 } @@ -54,7 +54,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "CountDocuments succeeds after NotMasterNoSlaveOk" + description: "CountDocuments succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13435 } @@ -63,7 +63,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "CountDocuments succeeds after NotMasterOrSecondary" + description: "CountDocuments succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13436 } @@ -126,7 +126,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "CountDocuments fails after two NotMaster errors" + description: "CountDocuments fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -139,7 +139,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "CountDocuments fails after NotMaster when retryReads is false" + description: "CountDocuments fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/distinct-serverErrors.json b/test/spec/retryable-reads/distinct-serverErrors.json index 109231c670..d7c6018a62 100644 --- a/test/spec/retryable-reads/distinct-serverErrors.json +++ b/test/spec/retryable-reads/distinct-serverErrors.json @@ -159,7 +159,7 @@ ] }, { - "description": "Distinct succeeds after NotMaster", + "description": "Distinct succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -222,7 +222,7 @@ ] }, { - "description": "Distinct succeeds after NotMasterNoSlaveOk", + "description": "Distinct succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -285,7 +285,7 @@ ] }, { - "description": "Distinct succeeds after NotMasterOrSecondary", + "description": "Distinct succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -726,7 +726,7 @@ ] }, { - "description": "Distinct fails after two NotMaster errors", + "description": "Distinct fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -786,7 +786,7 @@ ] }, { - "description": "Distinct fails after NotMaster when retryReads is false", + "description": "Distinct fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/distinct-serverErrors.yml b/test/spec/retryable-reads/distinct-serverErrors.yml index 3de14aeb08..d4bc118ff6 100644 --- a/test/spec/retryable-reads/distinct-serverErrors.yml +++ b/test/spec/retryable-reads/distinct-serverErrors.yml @@ -50,7 +50,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Distinct succeeds after NotMaster" + description: "Distinct succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [distinct], errorCode: 10107 } @@ -59,7 +59,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Distinct succeeds after NotMasterNoSlaveOk" + description: "Distinct succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [distinct], errorCode: 13435 } @@ -68,7 +68,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Distinct succeeds after NotMasterOrSecondary" + description: "Distinct succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [distinct], errorCode: 13436 } @@ -131,7 +131,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Distinct fails after two NotMaster errors" + description: "Distinct fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -144,7 +144,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Distinct fails after NotMaster when retryReads is false" + description: "Distinct fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-4.9.json b/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-4.9.json index af4dc52ea8..756b02b3a8 100644 --- a/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-4.9.json +++ b/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-4.9.json @@ -158,7 +158,7 @@ ] }, { - "description": "EstimatedDocumentCount succeeds after NotMaster", + "description": "EstimatedDocumentCount succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -228,7 +228,7 @@ ] }, { - "description": "EstimatedDocumentCount succeeds after NotMasterNoSlaveOk", + "description": "EstimatedDocumentCount succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -298,7 +298,7 @@ ] }, { - "description": "EstimatedDocumentCount succeeds after NotMasterOrSecondary", + "description": "EstimatedDocumentCount succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -788,7 +788,7 @@ ] }, { - "description": "EstimatedDocumentCount fails after two NotMaster errors", + "description": "EstimatedDocumentCount fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -858,7 +858,7 @@ ] }, { - "description": "EstimatedDocumentCount fails after NotMaster when retryReads is false", + "description": "EstimatedDocumentCount fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-4.9.yml b/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-4.9.yml index f08e740da2..1a73d54312 100644 --- a/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-4.9.yml +++ b/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-4.9.yml @@ -41,7 +41,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount succeeds after NotMaster" + description: "EstimatedDocumentCount succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 10107 } @@ -50,7 +50,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount succeeds after NotMasterNoSlaveOk" + description: "EstimatedDocumentCount succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13435 } @@ -59,7 +59,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount succeeds after NotMasterOrSecondary" + description: "EstimatedDocumentCount succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13436 } @@ -122,7 +122,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount fails after two NotMaster errors" + description: "EstimatedDocumentCount fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -135,7 +135,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount fails after NotMaster when retryReads is false" + description: "EstimatedDocumentCount fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-pre4.9.json b/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-pre4.9.json index c11e609cd4..0b9a2615d1 100644 --- a/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-pre4.9.json +++ b/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-pre4.9.json @@ -110,7 +110,7 @@ ] }, { - "description": "EstimatedDocumentCount succeeds after NotMaster", + "description": "EstimatedDocumentCount succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -150,7 +150,7 @@ ] }, { - "description": "EstimatedDocumentCount succeeds after NotMasterNoSlaveOk", + "description": "EstimatedDocumentCount succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -190,7 +190,7 @@ ] }, { - "description": "EstimatedDocumentCount succeeds after NotMasterOrSecondary", + "description": "EstimatedDocumentCount succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -470,7 +470,7 @@ ] }, { - "description": "EstimatedDocumentCount fails after two NotMaster errors", + "description": "EstimatedDocumentCount fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -510,7 +510,7 @@ ] }, { - "description": "EstimatedDocumentCount fails after NotMaster when retryReads is false", + "description": "EstimatedDocumentCount fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-pre4.9.yml b/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-pre4.9.yml index 0f0dcc656b..99c343b889 100644 --- a/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-pre4.9.yml +++ b/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-pre4.9.yml @@ -45,7 +45,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount succeeds after NotMaster" + description: "EstimatedDocumentCount succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [count], errorCode: 10107 } @@ -54,7 +54,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount succeeds after NotMasterNoSlaveOk" + description: "EstimatedDocumentCount succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [count], errorCode: 13435 } @@ -63,7 +63,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount succeeds after NotMasterOrSecondary" + description: "EstimatedDocumentCount succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [count], errorCode: 13436 } @@ -126,7 +126,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount fails after two NotMaster errors" + description: "EstimatedDocumentCount fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -139,7 +139,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount fails after NotMaster when retryReads is false" + description: "EstimatedDocumentCount fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/find-serverErrors.json b/test/spec/retryable-reads/find-serverErrors.json index 914b91da05..f6b96c6dcb 100644 --- a/test/spec/retryable-reads/find-serverErrors.json +++ b/test/spec/retryable-reads/find-serverErrors.json @@ -189,7 +189,7 @@ ] }, { - "description": "Find succeeds after NotMaster", + "description": "Find succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -263,7 +263,7 @@ ] }, { - "description": "Find succeeds after NotMasterNoSlaveOk", + "description": "Find succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -337,7 +337,7 @@ ] }, { - "description": "Find succeeds after NotMasterOrSecondary", + "description": "Find succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -855,7 +855,7 @@ ] }, { - "description": "Find fails after two NotMaster errors", + "description": "Find fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -912,7 +912,7 @@ ] }, { - "description": "Find fails after NotMaster when retryReads is false", + "description": "Find fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/find-serverErrors.yml b/test/spec/retryable-reads/find-serverErrors.yml index 17819ea862..e122f3e2c8 100644 --- a/test/spec/retryable-reads/find-serverErrors.yml +++ b/test/spec/retryable-reads/find-serverErrors.yml @@ -54,7 +54,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Find succeeds after NotMaster" + description: "Find succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 10107 } @@ -63,7 +63,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Find succeeds after NotMasterNoSlaveOk" + description: "Find succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 13435 } @@ -72,7 +72,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Find succeeds after NotMasterOrSecondary" + description: "Find succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 13436 } @@ -135,7 +135,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Find fails after two NotMaster errors" + description: "Find fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -148,7 +148,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Find fails after NotMaster when retryReads is false" + description: "Find fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/findOne-serverErrors.json b/test/spec/retryable-reads/findOne-serverErrors.json index 4c0c07234e..d039ef247e 100644 --- a/test/spec/retryable-reads/findOne-serverErrors.json +++ b/test/spec/retryable-reads/findOne-serverErrors.json @@ -149,7 +149,7 @@ ] }, { - "description": "FindOne succeeds after NotMaster", + "description": "FindOne succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -203,7 +203,7 @@ ] }, { - "description": "FindOne succeeds after NotMasterNoSlaveOk", + "description": "FindOne succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -257,7 +257,7 @@ ] }, { - "description": "FindOne succeeds after NotMasterOrSecondary", + "description": "FindOne succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -635,7 +635,7 @@ ] }, { - "description": "FindOne fails after two NotMaster errors", + "description": "FindOne fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -686,7 +686,7 @@ ] }, { - "description": "FindOne fails after NotMaster when retryReads is false", + "description": "FindOne fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/findOne-serverErrors.yml b/test/spec/retryable-reads/findOne-serverErrors.yml index 63ced439c9..b6e7657408 100644 --- a/test/spec/retryable-reads/findOne-serverErrors.yml +++ b/test/spec/retryable-reads/findOne-serverErrors.yml @@ -49,7 +49,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "FindOne succeeds after NotMaster" + description: "FindOne succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 10107 } @@ -58,7 +58,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "FindOne succeeds after NotMasterNoSlaveOk" + description: "FindOne succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 13435 } @@ -67,7 +67,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "FindOne succeeds after NotMasterOrSecondary" + description: "FindOne succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 13436 } @@ -130,7 +130,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "FindOne fails after two NotMaster errors" + description: "FindOne fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -143,7 +143,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "FindOne fails after NotMaster when retryReads is false" + description: "FindOne fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/gridfs-download-serverErrors.json b/test/spec/retryable-reads/gridfs-download-serverErrors.json index d54928b126..cec3a5016a 100644 --- a/test/spec/retryable-reads/gridfs-download-serverErrors.json +++ b/test/spec/retryable-reads/gridfs-download-serverErrors.json @@ -192,7 +192,7 @@ ] }, { - "description": "Download succeeds after NotMaster", + "description": "Download succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -262,7 +262,7 @@ ] }, { - "description": "Download succeeds after NotMasterNoSlaveOk", + "description": "Download succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -332,7 +332,7 @@ ] }, { - "description": "Download succeeds after NotMasterOrSecondary", + "description": "Download succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -822,7 +822,7 @@ ] }, { - "description": "Download fails after two NotMaster errors", + "description": "Download fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -877,7 +877,7 @@ ] }, { - "description": "Download fails after NotMaster when retryReads is false", + "description": "Download fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/gridfs-download-serverErrors.yml b/test/spec/retryable-reads/gridfs-download-serverErrors.yml index aa949a5632..e120c162fd 100644 --- a/test/spec/retryable-reads/gridfs-download-serverErrors.yml +++ b/test/spec/retryable-reads/gridfs-download-serverErrors.yml @@ -59,7 +59,7 @@ tests: - *retryable_command_started_event - *find_chunks_command_started_event - - description: "Download succeeds after NotMaster" + description: "Download succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 10107 } @@ -69,7 +69,7 @@ tests: - *retryable_command_started_event - *find_chunks_command_started_event - - description: "Download succeeds after NotMasterNoSlaveOk" + description: "Download succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 13435 } @@ -79,7 +79,7 @@ tests: - *retryable_command_started_event - *find_chunks_command_started_event - - description: "Download succeeds after NotMasterOrSecondary" + description: "Download succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 13436 } @@ -149,7 +149,7 @@ tests: - *retryable_command_started_event - *find_chunks_command_started_event - - description: "Download fails after two NotMaster errors" + description: "Download fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -162,7 +162,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Download fails after NotMaster when retryReads is false" + description: "Download fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.json b/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.json index 1325ab89ab..a64230d38a 100644 --- a/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.json +++ b/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.json @@ -180,7 +180,7 @@ ] }, { - "description": "DownloadByName succeeds after NotMaster", + "description": "DownloadByName succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -244,7 +244,7 @@ ] }, { - "description": "DownloadByName succeeds after NotMasterNoSlaveOk", + "description": "DownloadByName succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -308,7 +308,7 @@ ] }, { - "description": "DownloadByName succeeds after NotMasterOrSecondary", + "description": "DownloadByName succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -756,7 +756,7 @@ ] }, { - "description": "DownloadByName fails after two NotMaster errors", + "description": "DownloadByName fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -805,7 +805,7 @@ ] }, { - "description": "DownloadByName fails after NotMaster when retryReads is false", + "description": "DownloadByName fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.yml b/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.yml index a66ba9b140..704492135e 100644 --- a/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.yml +++ b/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.yml @@ -60,7 +60,7 @@ tests: - *retryable_command_started_event - *find_chunks_command_started_event - - description: "DownloadByName succeeds after NotMaster" + description: "DownloadByName succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 10107 } @@ -70,7 +70,7 @@ tests: - *retryable_command_started_event - *find_chunks_command_started_event - - description: "DownloadByName succeeds after NotMasterNoSlaveOk" + description: "DownloadByName succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 13435 } @@ -80,7 +80,7 @@ tests: - *retryable_command_started_event - *find_chunks_command_started_event - - description: "DownloadByName succeeds after NotMasterOrSecondary" + description: "DownloadByName succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 13436 } @@ -150,7 +150,7 @@ tests: - *retryable_command_started_event - *find_chunks_command_started_event - - description: "DownloadByName fails after two NotMaster errors" + description: "DownloadByName fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -163,7 +163,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "DownloadByName fails after NotMaster when retryReads is false" + description: "DownloadByName fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: @@ -171,4 +171,4 @@ tests: data: { failCommands: [find], errorCode: 10107 } operations: [*retryable_operation_fails] expectations: - - *retryable_command_started_event \ No newline at end of file + - *retryable_command_started_event diff --git a/test/spec/retryable-reads/listCollectionNames-serverErrors.json b/test/spec/retryable-reads/listCollectionNames-serverErrors.json index 90ccda7139..bbdce625ad 100644 --- a/test/spec/retryable-reads/listCollectionNames-serverErrors.json +++ b/test/spec/retryable-reads/listCollectionNames-serverErrors.json @@ -94,7 +94,7 @@ ] }, { - "description": "ListCollectionNames succeeds after NotMaster", + "description": "ListCollectionNames succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -131,7 +131,7 @@ ] }, { - "description": "ListCollectionNames succeeds after NotMasterNoSlaveOk", + "description": "ListCollectionNames succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -168,7 +168,7 @@ ] }, { - "description": "ListCollectionNames succeeds after NotMasterOrSecondary", + "description": "ListCollectionNames succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -427,7 +427,7 @@ ] }, { - "description": "ListCollectionNames fails after two NotMaster errors", + "description": "ListCollectionNames fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -465,7 +465,7 @@ ] }, { - "description": "ListCollectionNames fails after NotMaster when retryReads is false", + "description": "ListCollectionNames fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/listCollectionNames-serverErrors.yml b/test/spec/retryable-reads/listCollectionNames-serverErrors.yml index 889d2a5b5c..b99bddf827 100644 --- a/test/spec/retryable-reads/listCollectionNames-serverErrors.yml +++ b/test/spec/retryable-reads/listCollectionNames-serverErrors.yml @@ -38,7 +38,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionNames succeeds after NotMaster" + description: "ListCollectionNames succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listCollections], errorCode: 10107 } @@ -47,7 +47,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionNames succeeds after NotMasterNoSlaveOk" + description: "ListCollectionNames succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [listCollections], errorCode: 13435 } @@ -56,7 +56,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionNames succeeds after NotMasterOrSecondary" + description: "ListCollectionNames succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listCollections], errorCode: 13436 } @@ -119,7 +119,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionNames fails after two NotMaster errors" + description: "ListCollectionNames fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -132,7 +132,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionNames fails after NotMaster when retryReads is false" + description: "ListCollectionNames fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/listCollectionObjects-serverErrors.json b/test/spec/retryable-reads/listCollectionObjects-serverErrors.json index 6ca8c242fa..ab469dfe30 100644 --- a/test/spec/retryable-reads/listCollectionObjects-serverErrors.json +++ b/test/spec/retryable-reads/listCollectionObjects-serverErrors.json @@ -94,7 +94,7 @@ ] }, { - "description": "ListCollectionObjects succeeds after NotMaster", + "description": "ListCollectionObjects succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -131,7 +131,7 @@ ] }, { - "description": "ListCollectionObjects succeeds after NotMasterNoSlaveOk", + "description": "ListCollectionObjects succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -168,7 +168,7 @@ ] }, { - "description": "ListCollectionObjects succeeds after NotMasterOrSecondary", + "description": "ListCollectionObjects succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -427,7 +427,7 @@ ] }, { - "description": "ListCollectionObjects fails after two NotMaster errors", + "description": "ListCollectionObjects fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -465,7 +465,7 @@ ] }, { - "description": "ListCollectionObjects fails after NotMaster when retryReads is false", + "description": "ListCollectionObjects fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/listCollectionObjects-serverErrors.yml b/test/spec/retryable-reads/listCollectionObjects-serverErrors.yml index 97fb0778e4..b2ff9ee830 100644 --- a/test/spec/retryable-reads/listCollectionObjects-serverErrors.yml +++ b/test/spec/retryable-reads/listCollectionObjects-serverErrors.yml @@ -1,3 +1,7 @@ +# listCollectionObjects returns an array of MongoCollection objects. +# Not all drivers support this functionality. For more details, see: +# https://github.com/mongodb/specifications/blob/master/source/enumerate-collections.rst#returning-a-list-of-collection-objects + runOn: - minServerVersion: "4.0" @@ -38,7 +42,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionObjects succeeds after NotMaster" + description: "ListCollectionObjects succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listCollections], errorCode: 10107 } @@ -47,7 +51,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionObjects succeeds after NotMasterNoSlaveOk" + description: "ListCollectionObjects succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [listCollections], errorCode: 13435 } @@ -56,7 +60,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionObjects succeeds after NotMasterOrSecondary" + description: "ListCollectionObjects succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listCollections], errorCode: 13436 } @@ -119,7 +123,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionObjects fails after two NotMaster errors" + description: "ListCollectionObjects fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -132,7 +136,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionObjects fails after NotMaster when retryReads is false" + description: "ListCollectionObjects fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/listCollectionObjects.yml b/test/spec/retryable-reads/listCollectionObjects.yml index 885c0489af..4315694850 100644 --- a/test/spec/retryable-reads/listCollectionObjects.yml +++ b/test/spec/retryable-reads/listCollectionObjects.yml @@ -1,3 +1,7 @@ +# listCollectionObjects returns an array of MongoCollection objects. +# Not all drivers support this functionality. For more details, see: +# https://github.com/mongodb/specifications/blob/master/source/enumerate-collections.rst#returning-a-list-of-collection-objects + runOn: - minServerVersion: "4.0" diff --git a/test/spec/retryable-reads/listCollections-serverErrors.json b/test/spec/retryable-reads/listCollections-serverErrors.json index 1938fa4ab4..def9ac4595 100644 --- a/test/spec/retryable-reads/listCollections-serverErrors.json +++ b/test/spec/retryable-reads/listCollections-serverErrors.json @@ -94,7 +94,7 @@ ] }, { - "description": "ListCollections succeeds after NotMaster", + "description": "ListCollections succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -131,7 +131,7 @@ ] }, { - "description": "ListCollections succeeds after NotMasterNoSlaveOk", + "description": "ListCollections succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -168,7 +168,7 @@ ] }, { - "description": "ListCollections succeeds after NotMasterOrSecondary", + "description": "ListCollections succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -427,7 +427,7 @@ ] }, { - "description": "ListCollections fails after two NotMaster errors", + "description": "ListCollections fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -465,7 +465,7 @@ ] }, { - "description": "ListCollections fails after NotMaster when retryReads is false", + "description": "ListCollections fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/listCollections-serverErrors.yml b/test/spec/retryable-reads/listCollections-serverErrors.yml index bb35d8dbc7..94a9495e52 100644 --- a/test/spec/retryable-reads/listCollections-serverErrors.yml +++ b/test/spec/retryable-reads/listCollections-serverErrors.yml @@ -38,7 +38,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollections succeeds after NotMaster" + description: "ListCollections succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listCollections], errorCode: 10107 } @@ -47,7 +47,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollections succeeds after NotMasterNoSlaveOk" + description: "ListCollections succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [listCollections], errorCode: 13435 } @@ -56,7 +56,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollections succeeds after NotMasterOrSecondary" + description: "ListCollections succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listCollections], errorCode: 13436 } @@ -119,7 +119,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollections fails after two NotMaster errors" + description: "ListCollections fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -132,7 +132,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollections fails after NotMaster when retryReads is false" + description: "ListCollections fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/listDatabaseNames-serverErrors.json b/test/spec/retryable-reads/listDatabaseNames-serverErrors.json index eef8b7fe75..1dd8e4415a 100644 --- a/test/spec/retryable-reads/listDatabaseNames-serverErrors.json +++ b/test/spec/retryable-reads/listDatabaseNames-serverErrors.json @@ -94,7 +94,7 @@ ] }, { - "description": "ListDatabaseNames succeeds after NotMaster", + "description": "ListDatabaseNames succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -131,7 +131,7 @@ ] }, { - "description": "ListDatabaseNames succeeds after NotMasterNoSlaveOk", + "description": "ListDatabaseNames succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -168,7 +168,7 @@ ] }, { - "description": "ListDatabaseNames succeeds after NotMasterOrSecondary", + "description": "ListDatabaseNames succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -427,7 +427,7 @@ ] }, { - "description": "ListDatabaseNames fails after two NotMaster errors", + "description": "ListDatabaseNames fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -465,7 +465,7 @@ ] }, { - "description": "ListDatabaseNames fails after NotMaster when retryReads is false", + "description": "ListDatabaseNames fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/listDatabaseNames-serverErrors.yml b/test/spec/retryable-reads/listDatabaseNames-serverErrors.yml index ef777f0175..ca6b150944 100644 --- a/test/spec/retryable-reads/listDatabaseNames-serverErrors.yml +++ b/test/spec/retryable-reads/listDatabaseNames-serverErrors.yml @@ -38,7 +38,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseNames succeeds after NotMaster" + description: "ListDatabaseNames succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listDatabases], errorCode: 10107 } @@ -47,7 +47,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseNames succeeds after NotMasterNoSlaveOk" + description: "ListDatabaseNames succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [listDatabases], errorCode: 13435 } @@ -56,7 +56,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseNames succeeds after NotMasterOrSecondary" + description: "ListDatabaseNames succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listDatabases], errorCode: 13436 } @@ -119,7 +119,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseNames fails after two NotMaster errors" + description: "ListDatabaseNames fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -132,7 +132,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseNames fails after NotMaster when retryReads is false" + description: "ListDatabaseNames fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/listDatabaseObjects-serverErrors.json b/test/spec/retryable-reads/listDatabaseObjects-serverErrors.json index 054d1dc8b1..bc497bb088 100644 --- a/test/spec/retryable-reads/listDatabaseObjects-serverErrors.json +++ b/test/spec/retryable-reads/listDatabaseObjects-serverErrors.json @@ -94,7 +94,7 @@ ] }, { - "description": "ListDatabaseObjects succeeds after NotMaster", + "description": "ListDatabaseObjects succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -131,7 +131,7 @@ ] }, { - "description": "ListDatabaseObjects succeeds after NotMasterNoSlaveOk", + "description": "ListDatabaseObjects succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -168,7 +168,7 @@ ] }, { - "description": "ListDatabaseObjects succeeds after NotMasterOrSecondary", + "description": "ListDatabaseObjects succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -427,7 +427,7 @@ ] }, { - "description": "ListDatabaseObjects fails after two NotMaster errors", + "description": "ListDatabaseObjects fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -465,7 +465,7 @@ ] }, { - "description": "ListDatabaseObjects fails after NotMaster when retryReads is false", + "description": "ListDatabaseObjects fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/listDatabaseObjects-serverErrors.yml b/test/spec/retryable-reads/listDatabaseObjects-serverErrors.yml index f413304d31..adc8214a3b 100644 --- a/test/spec/retryable-reads/listDatabaseObjects-serverErrors.yml +++ b/test/spec/retryable-reads/listDatabaseObjects-serverErrors.yml @@ -1,3 +1,7 @@ +# listDatabaseObjects returns an array of MongoDatabase objects. +# Not all drivers support this functionality. For more details, see: +# https://github.com/mongodb/specifications/blob/master/source/enumerate-databases.rst#enumerating-mongodatabase-objects + runOn: - minServerVersion: "4.0" @@ -38,7 +42,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseObjects succeeds after NotMaster" + description: "ListDatabaseObjects succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listDatabases], errorCode: 10107 } @@ -47,7 +51,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseObjects succeeds after NotMasterNoSlaveOk" + description: "ListDatabaseObjects succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [listDatabases], errorCode: 13435 } @@ -56,7 +60,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseObjects succeeds after NotMasterOrSecondary" + description: "ListDatabaseObjects succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listDatabases], errorCode: 13436 } @@ -119,7 +123,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseObjects fails after two NotMaster errors" + description: "ListDatabaseObjects fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -132,7 +136,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseObjects fails after NotMaster when retryReads is false" + description: "ListDatabaseObjects fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/listDatabaseObjects.yml b/test/spec/retryable-reads/listDatabaseObjects.yml index e4a31cfe21..9ed2c216a5 100644 --- a/test/spec/retryable-reads/listDatabaseObjects.yml +++ b/test/spec/retryable-reads/listDatabaseObjects.yml @@ -1,3 +1,7 @@ +# listDatabaseObjects returns an array of MongoDatabase objects. +# Not all drivers support this functionality. For more details, see: +# https://github.com/mongodb/specifications/blob/master/source/enumerate-databases.rst#enumerating-mongodatabase-objects + runOn: - minServerVersion: "4.0" diff --git a/test/spec/retryable-reads/listDatabases-serverErrors.json b/test/spec/retryable-reads/listDatabases-serverErrors.json index 9da07b7f50..ed7bcbc398 100644 --- a/test/spec/retryable-reads/listDatabases-serverErrors.json +++ b/test/spec/retryable-reads/listDatabases-serverErrors.json @@ -94,7 +94,7 @@ ] }, { - "description": "ListDatabases succeeds after NotMaster", + "description": "ListDatabases succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -131,7 +131,7 @@ ] }, { - "description": "ListDatabases succeeds after NotMasterNoSlaveOk", + "description": "ListDatabases succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -168,7 +168,7 @@ ] }, { - "description": "ListDatabases succeeds after NotMasterOrSecondary", + "description": "ListDatabases succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -427,7 +427,7 @@ ] }, { - "description": "ListDatabases fails after two NotMaster errors", + "description": "ListDatabases fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -465,7 +465,7 @@ ] }, { - "description": "ListDatabases fails after NotMaster when retryReads is false", + "description": "ListDatabases fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/listDatabases-serverErrors.yml b/test/spec/retryable-reads/listDatabases-serverErrors.yml index a5ed406c84..ac904701de 100644 --- a/test/spec/retryable-reads/listDatabases-serverErrors.yml +++ b/test/spec/retryable-reads/listDatabases-serverErrors.yml @@ -38,7 +38,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabases succeeds after NotMaster" + description: "ListDatabases succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listDatabases], errorCode: 10107 } @@ -47,7 +47,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabases succeeds after NotMasterNoSlaveOk" + description: "ListDatabases succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [listDatabases], errorCode: 13435 } @@ -56,7 +56,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabases succeeds after NotMasterOrSecondary" + description: "ListDatabases succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listDatabases], errorCode: 13436 } @@ -119,7 +119,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabases fails after two NotMaster errors" + description: "ListDatabases fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -132,7 +132,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabases fails after NotMaster when retryReads is false" + description: "ListDatabases fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/listIndexNames-serverErrors.json b/test/spec/retryable-reads/listIndexNames-serverErrors.json index 3737e0059e..2d3265ec85 100644 --- a/test/spec/retryable-reads/listIndexNames-serverErrors.json +++ b/test/spec/retryable-reads/listIndexNames-serverErrors.json @@ -98,7 +98,7 @@ ] }, { - "description": "ListIndexNames succeeds after NotMaster", + "description": "ListIndexNames succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -137,7 +137,7 @@ ] }, { - "description": "ListIndexNames succeeds after NotMasterNoSlaveOk", + "description": "ListIndexNames succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -176,7 +176,7 @@ ] }, { - "description": "ListIndexNames succeeds after NotMasterOrSecondary", + "description": "ListIndexNames succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -449,7 +449,7 @@ ] }, { - "description": "ListIndexNames fails after two NotMaster errors", + "description": "ListIndexNames fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -489,7 +489,7 @@ ] }, { - "description": "ListIndexNames fails after NotMaster when retryReads is false", + "description": "ListIndexNames fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/listIndexNames-serverErrors.yml b/test/spec/retryable-reads/listIndexNames-serverErrors.yml index 5420d01aa7..6fb7e30cbf 100644 --- a/test/spec/retryable-reads/listIndexNames-serverErrors.yml +++ b/test/spec/retryable-reads/listIndexNames-serverErrors.yml @@ -39,7 +39,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexNames succeeds after NotMaster" + description: "ListIndexNames succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listIndexes], errorCode: 10107 } @@ -48,7 +48,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexNames succeeds after NotMasterNoSlaveOk" + description: "ListIndexNames succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [listIndexes], errorCode: 13435 } @@ -57,7 +57,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexNames succeeds after NotMasterOrSecondary" + description: "ListIndexNames succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listIndexes], errorCode: 13436 } @@ -120,7 +120,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexNames fails after two NotMaster errors" + description: "ListIndexNames fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -133,7 +133,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexNames fails after NotMaster when retryReads is false" + description: "ListIndexNames fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/listIndexes-serverErrors.json b/test/spec/retryable-reads/listIndexes-serverErrors.json index 6ac0b0a3f9..25c5b0e448 100644 --- a/test/spec/retryable-reads/listIndexes-serverErrors.json +++ b/test/spec/retryable-reads/listIndexes-serverErrors.json @@ -98,7 +98,7 @@ ] }, { - "description": "ListIndexes succeeds after NotMaster", + "description": "ListIndexes succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -137,7 +137,7 @@ ] }, { - "description": "ListIndexes succeeds after NotMasterNoSlaveOk", + "description": "ListIndexes succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -176,7 +176,7 @@ ] }, { - "description": "ListIndexes succeeds after NotMasterOrSecondary", + "description": "ListIndexes succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -449,7 +449,7 @@ ] }, { - "description": "ListIndexes fails after two NotMaster errors", + "description": "ListIndexes fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -489,7 +489,7 @@ ] }, { - "description": "ListIndexes fails after NotMaster when retryReads is false", + "description": "ListIndexes fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/listIndexes-serverErrors.yml b/test/spec/retryable-reads/listIndexes-serverErrors.yml index 7e203ae1d5..23f2768e9a 100644 --- a/test/spec/retryable-reads/listIndexes-serverErrors.yml +++ b/test/spec/retryable-reads/listIndexes-serverErrors.yml @@ -39,7 +39,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexes succeeds after NotMaster" + description: "ListIndexes succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listIndexes], errorCode: 10107 } @@ -48,7 +48,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexes succeeds after NotMasterNoSlaveOk" + description: "ListIndexes succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [listIndexes], errorCode: 13435 } @@ -57,7 +57,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexes succeeds after NotMasterOrSecondary" + description: "ListIndexes succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listIndexes], errorCode: 13436 } @@ -120,7 +120,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexes fails after two NotMaster errors" + description: "ListIndexes fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -133,7 +133,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexes fails after NotMaster when retryReads is false" + description: "ListIndexes fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/mapReduce.json b/test/spec/retryable-reads/mapReduce.json index e76aa76cbb..9327a23052 100644 --- a/test/spec/retryable-reads/mapReduce.json +++ b/test/spec/retryable-reads/mapReduce.json @@ -12,7 +12,8 @@ "topology": [ "sharded", "load-balanced" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", diff --git a/test/spec/retryable-reads/mapReduce.yml b/test/spec/retryable-reads/mapReduce.yml index 968d3d5037..def8b37485 100644 --- a/test/spec/retryable-reads/mapReduce.yml +++ b/test/spec/retryable-reads/mapReduce.yml @@ -5,6 +5,8 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded", "load-balanced"] + # serverless proxy does not support mapReduce operation + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/transactions/legacy/error-labels.json b/test/spec/transactions/legacy/error-labels.json index 2d3eed3ccc..f23be6ac92 100644 --- a/test/spec/transactions/legacy/error-labels.json +++ b/test/spec/transactions/legacy/error-labels.json @@ -10,7 +10,8 @@ "minServerVersion": "4.1.8", "topology": [ "sharded" - ] + ], + "serverless": "forbid" } ], "database_name": "transaction-tests", diff --git a/test/spec/transactions/legacy/error-labels.yml b/test/spec/transactions/legacy/error-labels.yml index 3fc36c8f0c..f0cfebf172 100644 --- a/test/spec/transactions/legacy/error-labels.yml +++ b/test/spec/transactions/legacy/error-labels.yml @@ -5,6 +5,9 @@ runOn: - minServerVersion: "4.1.8" topology: ["sharded"] + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + serverless: "forbid" database_name: &database_name "transaction-tests" collection_name: &collection_name "test" diff --git a/test/spec/transactions/legacy/mongos-pin-auto-tests.py b/test/spec/transactions/legacy/mongos-pin-auto-tests.py index b035c43689..1072ec2907 100644 --- a/test/spec/transactions/legacy/mongos-pin-auto-tests.py +++ b/test/spec/transactions/legacy/mongos-pin-auto-tests.py @@ -17,6 +17,9 @@ - minServerVersion: "4.1.8" topology: ["sharded"] + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + serverless: "forbid" database_name: &database_name "transaction-tests" collection_name: &collection_name "test" diff --git a/test/spec/transactions/legacy/mongos-pin-auto.json b/test/spec/transactions/legacy/mongos-pin-auto.json index f6ede52687..037f212f49 100644 --- a/test/spec/transactions/legacy/mongos-pin-auto.json +++ b/test/spec/transactions/legacy/mongos-pin-auto.json @@ -4,7 +4,8 @@ "minServerVersion": "4.1.8", "topology": [ "sharded" - ] + ], + "serverless": "forbid" } ], "database_name": "transaction-tests", diff --git a/test/spec/transactions/legacy/mongos-pin-auto.yml b/test/spec/transactions/legacy/mongos-pin-auto.yml index f2b84ac8de..7e2e3e4453 100644 --- a/test/spec/transactions/legacy/mongos-pin-auto.yml +++ b/test/spec/transactions/legacy/mongos-pin-auto.yml @@ -4,6 +4,9 @@ runOn: - minServerVersion: "4.1.8" topology: ["sharded"] + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + serverless: "forbid" database_name: &database_name "transaction-tests" collection_name: &collection_name "test" diff --git a/test/spec/transactions/legacy/mongos-recovery-token.json b/test/spec/transactions/legacy/mongos-recovery-token.json index 35ef45a039..3294628f20 100644 --- a/test/spec/transactions/legacy/mongos-recovery-token.json +++ b/test/spec/transactions/legacy/mongos-recovery-token.json @@ -4,7 +4,8 @@ "minServerVersion": "4.1.8", "topology": [ "sharded" - ] + ], + "serverless": "forbid" } ], "database_name": "transaction-tests", diff --git a/test/spec/transactions/legacy/mongos-recovery-token.yml b/test/spec/transactions/legacy/mongos-recovery-token.yml index 94f32b1d34..28334be177 100644 --- a/test/spec/transactions/legacy/mongos-recovery-token.yml +++ b/test/spec/transactions/legacy/mongos-recovery-token.yml @@ -2,6 +2,8 @@ runOn: - minServerVersion: "4.1.8" topology: ["sharded"] + # serverless proxy doesn't use recovery tokens + serverless: "forbid" database_name: &database_name "transaction-tests" collection_name: &collection_name "test" diff --git a/test/spec/transactions/legacy/pin-mongos.json b/test/spec/transactions/legacy/pin-mongos.json index 8e9d049d04..d089755869 100644 --- a/test/spec/transactions/legacy/pin-mongos.json +++ b/test/spec/transactions/legacy/pin-mongos.json @@ -4,7 +4,8 @@ "minServerVersion": "4.1.8", "topology": [ "sharded" - ] + ], + "serverless": "forbid" } ], "database_name": "transaction-tests", diff --git a/test/spec/transactions/legacy/pin-mongos.yml b/test/spec/transactions/legacy/pin-mongos.yml index b611e5003a..c1e40d42f7 100644 --- a/test/spec/transactions/legacy/pin-mongos.yml +++ b/test/spec/transactions/legacy/pin-mongos.yml @@ -16,6 +16,9 @@ runOn: - minServerVersion: "4.1.8" topology: ["sharded"] + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + serverless: "forbid" database_name: &database_name "transaction-tests" collection_name: &collection_name "test" diff --git a/test/spec/transactions/unified/mongos-unpin.json b/test/spec/transactions/unified/mongos-unpin.json index 2e17c5d254..c01abf3076 100644 --- a/test/spec/transactions/unified/mongos-unpin.json +++ b/test/spec/transactions/unified/mongos-unpin.json @@ -1,6 +1,6 @@ { "description": "mongos-unpin", - "schemaVersion": "1.1", + "schemaVersion": "1.4", "runOnRequirements": [ { "minServerVersion": "4.2", @@ -50,6 +50,11 @@ "tests": [ { "description": "unpin after TransientTransctionError error on commit", + "runOnRequirements": [ + { + "serverless": "forbid" + } + ], "operations": [ { "name": "startTransaction", @@ -138,6 +143,11 @@ }, { "description": "unpin after TransientTransctionError error on abort", + "runOnRequirements": [ + { + "serverless": "forbid" + } + ], "operations": [ { "name": "startTransaction", diff --git a/test/spec/transactions/unified/mongos-unpin.yml b/test/spec/transactions/unified/mongos-unpin.yml index e43071ddf8..46433d8c45 100644 --- a/test/spec/transactions/unified/mongos-unpin.yml +++ b/test/spec/transactions/unified/mongos-unpin.yml @@ -1,6 +1,6 @@ description: mongos-unpin -schemaVersion: '1.1' +schemaVersion: '1.4' runOnRequirements: - minServerVersion: '4.2' @@ -34,6 +34,10 @@ _yamlAnchors: tests: - description: unpin after TransientTransctionError error on commit + runOnRequirements: + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + - serverless: "forbid" operations: - &startTransaction name: startTransaction @@ -77,6 +81,10 @@ tests: - *assertNoPinnedServer - description: unpin after TransientTransctionError error on abort + runOnRequirements: + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + - serverless: "forbid" operations: - *startTransaction - *insertOne diff --git a/test/spec/unified-test-format/invalid/expectedEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedEvent-additionalProperties.json deleted file mode 100644 index 2c4f7d27e7..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-additionalProperties.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "description": "expectedEvent-additionalProperties", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "foo": 0 - } - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedEvent-additionalProperties.yml deleted file mode 100644 index c2c1cb5a7c..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-additionalProperties.yml +++ /dev/null @@ -1,17 +0,0 @@ -description: "expectedEvent-additionalProperties" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - foo: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandFailedEvent-commandName-type.json b/test/spec/unified-test-format/invalid/expectedEvent-commandFailedEvent-commandName-type.json deleted file mode 100644 index ea6078faae..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandFailedEvent-commandName-type.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "description": "expectedEvent-commandFailedEvent-commandName-type", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandFailedEvent": { - "commandName": 0 - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandFailedEvent-commandName-type.yml b/test/spec/unified-test-format/invalid/expectedEvent-commandFailedEvent-commandName-type.yml deleted file mode 100644 index 57504b78f8..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandFailedEvent-commandName-type.yml +++ /dev/null @@ -1,18 +0,0 @@ -description: "expectedEvent-commandFailedEvent-commandName-type" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - commandFailedEvent: - commandName: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-additionalProperties.json deleted file mode 100644 index ee6eb50658..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-additionalProperties.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "description": "expectedEvent-commandStartedEvent-additionalProperties", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "foo": 0 - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-additionalProperties.yml deleted file mode 100644 index 6ea724ddfb..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-additionalProperties.yml +++ /dev/null @@ -1,18 +0,0 @@ -description: "expectedEvent-commandStartedEvent-additionalProperties" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - foo: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-command-type.json b/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-command-type.json deleted file mode 100644 index 4c9483caf3..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-command-type.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "description": "expectedEvent-commandStartedEvent-command-type", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": 0 - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-command-type.yml b/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-command-type.yml deleted file mode 100644 index 91ba129869..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-command-type.yml +++ /dev/null @@ -1,18 +0,0 @@ -description: "expectedEvent-commandStartedEvent-command-type" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-commandName-type.json b/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-commandName-type.json deleted file mode 100644 index a5a66096a0..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-commandName-type.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "description": "expectedEvent-commandStartedEvent-commandName-type", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": 0 - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-commandName-type.yml b/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-commandName-type.yml deleted file mode 100644 index 07c968cdd4..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-commandName-type.yml +++ /dev/null @@ -1,18 +0,0 @@ -description: "expectedEvent-commandStartedEvent-commandName-type" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - commandName: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-databaseName-type.json b/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-databaseName-type.json deleted file mode 100644 index dc040ec108..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-databaseName-type.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "description": "expectedEvent-commandStartedEvent-databaseName-type", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": 0 - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-databaseName-type.yml b/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-databaseName-type.yml deleted file mode 100644 index 355d90d6f7..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-databaseName-type.yml +++ /dev/null @@ -1,18 +0,0 @@ -description: "expectedEvent-commandStartedEvent-databaseName-type" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - databaseName: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-commandName-type.json b/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-commandName-type.json deleted file mode 100644 index 4a20e906b9..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-commandName-type.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "description": "expectedEvent-commandSucceededEvent-commandName-type", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandSucceededEvent": { - "commandName": 0 - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-commandName-type.yml b/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-commandName-type.yml deleted file mode 100644 index 740b377fa2..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-commandName-type.yml +++ /dev/null @@ -1,18 +0,0 @@ -description: "expectedEvent-commandSucceededEvent-commandName-type" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - commandSucceededEvent: - commandName: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-reply-type.json b/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-reply-type.json deleted file mode 100644 index 5464542751..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-reply-type.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "description": "expectedEvent-commandSucceededEvent-reply-type", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandSucceededEvent": { - "reply": 0 - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-reply-type.yml b/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-reply-type.yml deleted file mode 100644 index 5a4b35e272..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-reply-type.yml +++ /dev/null @@ -1,18 +0,0 @@ -description: "expectedEvent-commandSucceededEvent-reply-type" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - commandSucceededEvent: - reply: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEvent-maxProperties.json b/test/spec/unified-test-format/invalid/expectedEvent-maxProperties.json deleted file mode 100644 index f01441946f..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-maxProperties.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "description": "expectedEvent-maxProperties", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": {}, - "commandSucceededEvent": {} - } - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-maxProperties.yml b/test/spec/unified-test-format/invalid/expectedEvent-maxProperties.yml deleted file mode 100644 index d349133ea1..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-maxProperties.yml +++ /dev/null @@ -1,18 +0,0 @@ -description: "expectedEvent-maxProperties" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - commandStartedEvent: {} - commandSucceededEvent: {} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-minProperties.json b/test/spec/unified-test-format/invalid/expectedEvent-minProperties.json deleted file mode 100644 index ebcc494894..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-minProperties.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "description": "expectedEvent-minProperties", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - {} - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-minProperties.yml b/test/spec/unified-test-format/invalid/expectedEvent-minProperties.yml deleted file mode 100644 index 88de63a898..0000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-minProperties.yml +++ /dev/null @@ -1,17 +0,0 @@ -description: "expectedEvent-minProperties" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - {} diff --git a/test/spec/unified-test-format/invalid/runOnRequirement-serverless-enum.json b/test/spec/unified-test-format/invalid/runOnRequirement-serverless-enum.json new file mode 100644 index 0000000000..031fa539df --- /dev/null +++ b/test/spec/unified-test-format/invalid/runOnRequirement-serverless-enum.json @@ -0,0 +1,15 @@ +{ + "description": "runOnRequirement-serverless-enum", + "schemaVersion": "1.4", + "runOnRequirements": [ + { + "serverless": "foo" + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/runOnRequirement-serverless-enum.yml b/test/spec/unified-test-format/invalid/runOnRequirement-serverless-enum.yml new file mode 100644 index 0000000000..6db134500b --- /dev/null +++ b/test/spec/unified-test-format/invalid/runOnRequirement-serverless-enum.yml @@ -0,0 +1,10 @@ +description: "runOnRequirement-serverless-enum" + +schemaVersion: "1.4" + +runOnRequirements: + - serverless: "foo" + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/runOnRequirement-serverless-type.json b/test/spec/unified-test-format/invalid/runOnRequirement-serverless-type.json new file mode 100644 index 0000000000..1aa41712f9 --- /dev/null +++ b/test/spec/unified-test-format/invalid/runOnRequirement-serverless-type.json @@ -0,0 +1,15 @@ +{ + "description": "runOnRequirement-serverless-type", + "schemaVersion": "1.4", + "runOnRequirements": [ + { + "serverless": 1234 + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/runOnRequirement-serverless-type.yml b/test/spec/unified-test-format/invalid/runOnRequirement-serverless-type.yml new file mode 100644 index 0000000000..82a7ed31d5 --- /dev/null +++ b/test/spec/unified-test-format/invalid/runOnRequirement-serverless-type.yml @@ -0,0 +1,10 @@ +description: runOnRequirement-serverless-type + +schemaVersion: '1.4' + +runOnRequirements: + - serverless: 1234 + +tests: + - description: foo + operations: [] diff --git a/test/spec/unified-test-format/valid-pass/poc-crud.json b/test/spec/unified-test-format/valid-pass/poc-crud.json new file mode 100644 index 0000000000..0790d9b789 --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/poc-crud.json @@ -0,0 +1,450 @@ +{ + "description": "poc-crud", + "schemaVersion": "1.4", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-tests" + } + }, + { + "database": { + "id": "database1", + "client": "client0", + "databaseName": "admin" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + }, + { + "collection": { + "id": "collection1", + "database": "database0", + "collectionName": "coll1" + } + }, + { + "collection": { + "id": "collection2", + "database": "database0", + "collectionName": "coll2", + "collectionOptions": { + "readConcern": { + "level": "majority" + } + } + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + }, + { + "collectionName": "coll1", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + }, + { + "collectionName": "coll2", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + }, + { + "collectionName": "aggregate_out", + "databaseName": "crud-tests", + "documents": [] + } + ], + "tests": [ + { + "description": "BulkWrite with mixed ordered operations", + "operations": [ + { + "name": "bulkWrite", + "object": "collection0", + "arguments": { + "requests": [ + { + "insertOne": { + "document": { + "_id": 3, + "x": 33 + } + } + }, + { + "updateOne": { + "filter": { + "_id": 2 + }, + "update": { + "$inc": { + "x": 1 + } + } + } + }, + { + "updateMany": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + } + } + }, + { + "insertOne": { + "document": { + "_id": 4, + "x": 44 + } + } + }, + { + "deleteMany": { + "filter": { + "x": { + "$nin": [ + 24, + 34 + ] + } + } + } + }, + { + "replaceOne": { + "filter": { + "_id": 4 + }, + "replacement": { + "_id": 4, + "x": 44 + }, + "upsert": true + } + } + ], + "ordered": true + }, + "expectResult": { + "deletedCount": 2, + "insertedCount": 2, + "insertedIds": { + "$$unsetOrMatches": { + "0": 3, + "3": 4 + } + }, + "matchedCount": 3, + "modifiedCount": 3, + "upsertedCount": 1, + "upsertedIds": { + "5": 4 + } + } + } + ], + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 2, + "x": 24 + }, + { + "_id": 3, + "x": 34 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + }, + { + "description": "InsertMany continue-on-error behavior with unordered (duplicate key in requests)", + "operations": [ + { + "name": "insertMany", + "object": "collection1", + "arguments": { + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ], + "ordered": false + }, + "expectError": { + "expectResult": { + "$$unsetOrMatches": { + "deletedCount": 0, + "insertedCount": 2, + "matchedCount": 0, + "modifiedCount": 0, + "upsertedCount": 0, + "upsertedIds": {} + } + } + } + } + ], + "outcome": [ + { + "collectionName": "coll1", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "ReplaceOne prohibits atomic modifiers", + "operations": [ + { + "name": "replaceOne", + "object": "collection1", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "$set": { + "x": 22 + } + } + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "coll1", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ] + }, + { + "description": "readConcern majority with out stage", + "runOnRequirements": [ + { + "minServerVersion": "4.1.0", + "topologies": [ + "replicaset", + "sharded-replicaset" + ], + "serverless": "forbid" + } + ], + "operations": [ + { + "name": "aggregate", + "object": "collection2", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "aggregate_out" + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "coll2", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "aggregate_out" + } + ], + "readConcern": { + "level": "majority" + } + }, + "commandName": "aggregate", + "databaseName": "crud-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "aggregate_out", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "Aggregate with $listLocalSessions", + "runOnRequirements": [ + { + "minServerVersion": "3.6.0", + "serverless": "forbid" + } + ], + "operations": [ + { + "name": "aggregate", + "object": "database1", + "arguments": { + "pipeline": [ + { + "$listLocalSessions": {} + }, + { + "$limit": 1 + }, + { + "$addFields": { + "dummy": "dummy field" + } + }, + { + "$project": { + "_id": 0, + "dummy": 1 + } + } + ] + }, + "expectResult": [ + { + "dummy": "dummy field" + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-pass/poc-crud.yml b/test/spec/unified-test-format/valid-pass/poc-crud.yml new file mode 100644 index 0000000000..b7d05d75af --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/poc-crud.yml @@ -0,0 +1,190 @@ +description: "poc-crud" + +schemaVersion: "1.4" + +createEntities: + - client: + id: &client0 client0 + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name crud-tests + - database: + id: &database1 database1 + client: *client0 + databaseName: &database1Name admin + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + - collection: + id: &collection1 collection1 + database: *database0 + collectionName: &collection1Name coll1 + - collection: + id: &collection2 collection2 + database: *database0 + collectionName: &collection2Name coll2 + collectionOptions: + readConcern: { level: majority } + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - { _id: 2, x: 22 } + - collectionName: *collection1Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - collectionName: *collection2Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + - collectionName: &out aggregate_out + databaseName: *database0Name + documents: [] + +tests: + - description: "BulkWrite with mixed ordered operations" + operations: + - name: bulkWrite + object: *collection0 + arguments: + requests: + - insertOne: + document: { _id: 3, x: 33 } + - updateOne: + filter: { _id: 2 } + update: { $inc: { x: 1 } } + - updateMany: + filter: { _id: { $gt: 1 } } + update: { $inc: { x: 1 } } + - insertOne: + document: { _id: 4, x: 44 } + - deleteMany: + filter: { x: { $nin: [ 24, 34 ] } } + - replaceOne: + filter: { _id: 4 } + replacement: { _id: 4, x: 44 } + upsert: true + ordered: true + expectResult: + deletedCount: 2 + insertedCount: 2 + insertedIds: { $$unsetOrMatches: { 0: 3, 3: 4 } } + matchedCount: 3 + modifiedCount: 3 + upsertedCount: 1 + upsertedIds: { 5: 4 } + outcome: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - {_id: 2, x: 24 } + - {_id: 3, x: 34 } + - {_id: 4, x: 44 } + + - description: "InsertMany continue-on-error behavior with unordered (duplicate key in requests)" + operations: + - name: insertMany + object: *collection1 + arguments: + documents: + - { _id: 2, x: 22 } + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + ordered: false + expectError: + expectResult: + # insertMany throws BulkWriteException, which may optionally include + # an intermediary BulkWriteResult + $$unsetOrMatches: + deletedCount: 0 + insertedCount: 2 + # Since the map of insertedIds is generated before execution it + # could indicate inserts that did not actually succeed. We omit + # this field rather than expect drivers to provide an accurate + # map filtered by write errors. + matchedCount: 0 + modifiedCount: 0 + upsertedCount: 0 + upsertedIds: { } + outcome: + - collectionName: *collection1Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + + - description: "ReplaceOne prohibits atomic modifiers" + operations: + - name: replaceOne + object: *collection1 + arguments: + filter: { _id: 1 } + replacement: { $set: { x: 22 }} + expectError: + isClientError: true + expectEvents: + - client: *client0 + events: [] + outcome: + - collectionName: *collection1Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + + - description: "readConcern majority with out stage" + runOnRequirements: + - minServerVersion: "4.1.0" + topologies: [ replicaset, sharded-replicaset ] + serverless: "forbid" + operations: + - name: aggregate + object: *collection2 + arguments: + pipeline: &pipeline + - $sort: { x : 1 } + - $match: { _id: { $gt: 1 } } + - $out: *out + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + aggregate: *collection2Name + pipeline: *pipeline + readConcern: { level: majority } + # The following two assertions were not in the original test + commandName: aggregate + databaseName: *database0Name + outcome: + - collectionName: *out + databaseName: *database0Name + documents: + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + + - description: "Aggregate with $listLocalSessions" + runOnRequirements: + - minServerVersion: "3.6.0" + # serverless does not support either of the current database-level aggregation stages ($listLocalSessions and + # $currentOp) + serverless: forbid + operations: + - name: aggregate + object: *database1 + arguments: + pipeline: + - $listLocalSessions: { } + - $limit: 1 + - $addFields: { dummy: "dummy field"} + - $project: { _id: 0, dummy: 1} + expectResult: + - { dummy: "dummy field" } diff --git a/test/spec/unified-test-format/valid-pass/poc-retryable-writes.json b/test/spec/unified-test-format/valid-pass/poc-retryable-writes.json index 30c1d54152..50160799f3 100644 --- a/test/spec/unified-test-format/valid-pass/poc-retryable-writes.json +++ b/test/spec/unified-test-format/valid-pass/poc-retryable-writes.json @@ -298,9 +298,6 @@ }, "expectResult": { "$$unsetOrMatches": { - "insertedCount": { - "$$unsetOrMatches": 2 - }, "insertedIds": { "$$unsetOrMatches": { "0": 3, diff --git a/test/spec/unified-test-format/valid-pass/poc-retryable-writes.yml b/test/spec/unified-test-format/valid-pass/poc-retryable-writes.yml index 47ded3a5fb..fa882e2836 100644 --- a/test/spec/unified-test-format/valid-pass/poc-retryable-writes.yml +++ b/test/spec/unified-test-format/valid-pass/poc-retryable-writes.yml @@ -141,9 +141,8 @@ tests: - { _id: 4, x: 44 } ordered: true expectResult: - $$unsetOrMatches: - insertedCount: { $$unsetOrMatches: 2 } - insertedIds: { $$unsetOrMatches: { 0: 3, 1: 4 } } + # InsertManyResult is optional because all of its fields are optional + $$unsetOrMatches: { insertedIds: { $$unsetOrMatches: { 0: 3, 1: 4 } } } outcome: - collectionName: *collectionName databaseName: *databaseName