-
Notifications
You must be signed in to change notification settings - Fork 899
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50cf0c2
commit 5051f3b
Showing
4 changed files
with
484 additions
and
0 deletions.
There are no files selected for viewing
163 changes: 163 additions & 0 deletions
163
testdata/crud/unified/client-bulkWrite-replaceOne-sort.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
{ | ||
"description": "client bulkWrite updateOne-sort", | ||
"schemaVersion": "1.4", | ||
"runOnRequirements": [ | ||
{ | ||
"minServerVersion": "8.0", | ||
"serverless": "forbid" | ||
} | ||
], | ||
"createEntities": [ | ||
{ | ||
"client": { | ||
"id": "client0", | ||
"observeEvents": [ | ||
"commandStartedEvent", | ||
"commandSucceededEvent" | ||
] | ||
} | ||
}, | ||
{ | ||
"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 | ||
} | ||
] | ||
} | ||
], | ||
"_yamlAnchors": { | ||
"namespace": "crud-tests.coll0" | ||
}, | ||
"tests": [ | ||
{ | ||
"description": "client bulkWrite replaceOne with sort option", | ||
"operations": [ | ||
{ | ||
"object": "client0", | ||
"name": "clientBulkWrite", | ||
"arguments": { | ||
"models": [ | ||
{ | ||
"replaceOne": { | ||
"namespace": "crud-tests.coll0", | ||
"filter": { | ||
"_id": { | ||
"$gt": 1 | ||
} | ||
}, | ||
"sort": { | ||
"_id": -1 | ||
}, | ||
"replacement": { | ||
"x": 1 | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"expectEvents": [ | ||
{ | ||
"client": "client0", | ||
"events": [ | ||
{ | ||
"commandStartedEvent": { | ||
"commandName": "bulkWrite", | ||
"databaseName": "admin", | ||
"command": { | ||
"bulkWrite": 1, | ||
"ops": [ | ||
{ | ||
"update": 0, | ||
"filter": { | ||
"_id": { | ||
"$gt": 1 | ||
} | ||
}, | ||
"updateMods": { | ||
"x": 1 | ||
}, | ||
"sort": { | ||
"_id": -1 | ||
}, | ||
"multi": { | ||
"$$unsetOrMatches": false | ||
}, | ||
"upsert": { | ||
"$$unsetOrMatches": false | ||
} | ||
} | ||
], | ||
"nsInfo": [ | ||
{ | ||
"ns": "crud-tests.coll0" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"commandSucceededEvent": { | ||
"reply": { | ||
"ok": 1, | ||
"nErrors": 0, | ||
"nMatched": 1, | ||
"nModified": 1 | ||
}, | ||
"commandName": "bulkWrite" | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"outcome": [ | ||
{ | ||
"collectionName": "coll0", | ||
"databaseName": "crud-tests", | ||
"documents": [ | ||
{ | ||
"_id": 1, | ||
"x": 11 | ||
}, | ||
{ | ||
"_id": 2, | ||
"x": 22 | ||
}, | ||
{ | ||
"_id": 3, | ||
"x": 1 | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
77 changes: 77 additions & 0 deletions
77
testdata/crud/unified/client-bulkWrite-replaceOne-sort.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
description: client bulkWrite updateOne-sort | ||
|
||
schemaVersion: "1.4" | ||
|
||
runOnRequirements: | ||
- minServerVersion: "8.0" | ||
serverless: forbid # Serverless does not support bulkWrite: CLOUDP-256344. | ||
|
||
createEntities: | ||
- client: | ||
id: &client0 client0 | ||
observeEvents: | ||
- commandStartedEvent | ||
- commandSucceededEvent | ||
- database: | ||
id: &database0 database0 | ||
client: *client0 | ||
databaseName: &database0Name crud-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 } | ||
|
||
_yamlAnchors: | ||
namespace: &namespace "crud-tests.coll0" | ||
|
||
tests: | ||
- description: client bulkWrite replaceOne with sort option | ||
operations: | ||
- object: *client0 | ||
name: clientBulkWrite | ||
arguments: | ||
models: | ||
- replaceOne: | ||
namespace: *namespace | ||
filter: { _id: { $gt: 1 } } | ||
sort: { _id: -1 } | ||
replacement: { x: 1 } | ||
expectEvents: | ||
- client: *client0 | ||
events: | ||
- commandStartedEvent: | ||
commandName: bulkWrite | ||
databaseName: admin | ||
command: | ||
bulkWrite: 1 | ||
ops: | ||
- update: 0 | ||
filter: { _id: { $gt: 1 } } | ||
updateMods: { x: 1 } | ||
sort: { _id: -1 } | ||
multi: { $$unsetOrMatches: false } | ||
upsert: { $$unsetOrMatches: false } | ||
nsInfo: | ||
- ns: *namespace | ||
- commandSucceededEvent: | ||
reply: | ||
ok: 1 | ||
nErrors: 0 | ||
nMatched: 1 | ||
nModified: 1 | ||
commandName: bulkWrite | ||
outcome: | ||
- collectionName: *collection0Name | ||
databaseName: *database0Name | ||
documents: | ||
- { _id: 1, x: 11 } | ||
- { _id: 2, x: 22 } | ||
- { _id: 3, x: 1 } |
Oops, something went wrong.