bson/testdata/crud/unified/updateOne-comment.yml
2025-03-17 20:58:26 +01:00

105 lines
2.9 KiB
YAML

description: "updateOne-comment"
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 with string comment"
runOnRequirements:
- minServerVersion: "4.4"
operations:
- name: updateOne
object: *collection0
arguments:
filter: &filter { _id: 1 }
update: &update { $set: {x: 22} }
comment: "comment"
expectEvents:
- client: *client0
events:
- commandStartedEvent:
command:
update: *collection0Name
updates:
-
q: *filter
u: *update
multi: { $$unsetOrMatches: false }
upsert: { $$unsetOrMatches: false }
comment: "comment"
outcome: &outcome
- collectionName: *collection0Name
databaseName: *database0Name
documents:
- { _id: 1, x: 22 }
- description: "UpdateOne with document comment"
runOnRequirements:
- minServerVersion: "4.4"
operations:
- name: updateOne
object: *collection0
arguments:
filter: *filter
update: *update
comment: &comment { key: "value" }
expectEvents:
- client: *client0
events:
- commandStartedEvent:
command:
update: *collection0Name
updates:
-
q: *filter
u: *update
multi: { $$unsetOrMatches: false }
upsert: { $$unsetOrMatches: false }
comment: *comment
outcome: *outcome
- description: "UpdateOne with comment - pre 4.4"
runOnRequirements:
- minServerVersion: "3.4.0"
maxServerVersion: "4.2.99"
operations:
- name: updateOne
object: *collection0
arguments:
filter: *filter
update: *update
comment: "comment"
expectError:
isClientError: false
expectEvents:
- client: *client0
events:
- commandStartedEvent:
command:
update: *collection0Name
updates:
-
q: *filter
u: *update
multi: { $$unsetOrMatches: false }
upsert: { $$unsetOrMatches: false }
comment: "comment"
outcome: *initialData