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

100 lines
2.6 KiB
YAML

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