forked from mongodb/mongo-go-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GODRIVER-3285 Allow update to supply sort option.
- Loading branch information
1 parent
8dc4e78
commit a53f721
Showing
9 changed files
with
443 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
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
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,125 @@ | ||
{ | ||
"description": "updateMany", | ||
"schemaVersion": "1.0", | ||
"runOnRequirements": [ | ||
{ | ||
"minServerVersion": "8.0" | ||
} | ||
], | ||
"createEntities": [ | ||
{ | ||
"client": { | ||
"id": "client", | ||
"observeEvents": [ | ||
"commandStartedEvent", | ||
"commandSucceededEvent", | ||
"commandFailedEvent" | ||
] | ||
} | ||
}, | ||
{ | ||
"database": { | ||
"id": "database", | ||
"client": "client", | ||
"databaseName": "command-monitoring-tests" | ||
} | ||
}, | ||
{ | ||
"collection": { | ||
"id": "collection", | ||
"database": "database", | ||
"collectionName": "test" | ||
} | ||
} | ||
], | ||
"initialData": [ | ||
{ | ||
"collectionName": "test", | ||
"databaseName": "command-monitoring-tests", | ||
"documents": [ | ||
{ | ||
"_id": 1, | ||
"x": 11 | ||
}, | ||
{ | ||
"_id": 2, | ||
"x": 22 | ||
}, | ||
{ | ||
"_id": 3, | ||
"x": 33 | ||
} | ||
] | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "A successful updateMany with sort", | ||
"operations": [ | ||
{ | ||
"name": "updateMany", | ||
"object": "collection", | ||
"arguments": { | ||
"filter": { | ||
"_id": { | ||
"$gt": 1 | ||
} | ||
}, | ||
"sort": { | ||
"_id": -1 | ||
}, | ||
"update": { | ||
"$inc": { | ||
"x": 1 | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"expectEvents": [ | ||
{ | ||
"client": "client", | ||
"events": [ | ||
{ | ||
"commandStartedEvent": { | ||
"command": { | ||
"update": "test", | ||
"updates": [ | ||
{ | ||
"q": { | ||
"_id": { | ||
"$gt": 1 | ||
} | ||
}, | ||
"u": { | ||
"$inc": { | ||
"x": 1 | ||
} | ||
}, | ||
"upsert": { | ||
"$$unsetOrMatches": false | ||
}, | ||
"multi": true | ||
} | ||
], | ||
"ordered": true | ||
}, | ||
"commandName": "update", | ||
"databaseName": "command-monitoring-tests" | ||
} | ||
}, | ||
{ | ||
"commandSucceededEvent": { | ||
"reply": { | ||
"ok": 1, | ||
"n": 2 | ||
}, | ||
"commandName": "update" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
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,57 @@ | ||
description: "updateMany" | ||
|
||
schemaVersion: "1.0" | ||
|
||
runOnRequirements: | ||
- minServerVersion: "8.0" | ||
|
||
createEntities: | ||
- client: | ||
id: &client client | ||
observeEvents: | ||
- commandStartedEvent | ||
- commandSucceededEvent | ||
- commandFailedEvent | ||
- database: | ||
id: &database database | ||
client: *client | ||
databaseName: &databaseName command-monitoring-tests | ||
- collection: | ||
id: &collection collection | ||
database: *database | ||
collectionName: &collectionName test | ||
|
||
initialData: | ||
- collectionName: *collectionName | ||
databaseName: *databaseName | ||
documents: | ||
- { _id: 1, x: 11 } | ||
- { _id: 2, x: 22 } | ||
- { _id: 3, x: 33 } | ||
|
||
tests: | ||
- description: "A successful updateMany with sort" | ||
operations: | ||
- name: updateMany | ||
object: *collection | ||
arguments: | ||
filter: { _id: { $gt: 1 } } | ||
sort: { _id: -1 } | ||
update: { $inc: { x: 1 } } | ||
expectEvents: | ||
- client: *client | ||
events: | ||
- commandStartedEvent: | ||
command: | ||
update: *collectionName | ||
updates: | ||
- q: { _id: { $gt: 1 } } | ||
u: { $inc: { x: 1 } } | ||
upsert: { $$unsetOrMatches: false } | ||
multi: true | ||
ordered: true | ||
commandName: update | ||
databaseName: *databaseName | ||
- commandSucceededEvent: | ||
reply: { ok: 1, n: 2 } | ||
commandName: update |
Oops, something went wrong.