...
1description: "replaceOne-comment"
2
3schemaVersion: "1.0"
4
5createEntities:
6 - client:
7 id: &client0 client0
8 observeEvents: [ commandStartedEvent ]
9 - database:
10 id: &database0 database0
11 client: *client0
12 databaseName: &database0Name crud-tests
13 - collection:
14 id: &collection0 collection0
15 database: *database0
16 collectionName: &collection0Name coll0
17
18initialData: &initialData
19 - collectionName: *collection0Name
20 databaseName: *database0Name
21 documents:
22 - { _id: 1, x: 11 }
23
24tests:
25 - description: "ReplaceOne with string comment"
26 runOnRequirements:
27 - minServerVersion: "4.4"
28 operations:
29 - name: replaceOne
30 object: *collection0
31 arguments:
32 filter: &filter { _id: 1 }
33 replacement: &replacement { x: 22 }
34 comment: "comment"
35 expectEvents:
36 - client: *client0
37 events:
38 - commandStartedEvent:
39 command:
40 update: *collection0Name
41 updates:
42 -
43 q: *filter
44 u: *replacement
45 comment: "comment"
46 outcome: &outcome
47 - collectionName: *collection0Name
48 databaseName: *database0Name
49 documents:
50 - { _id: 1, x: 22 }
51
52 - description: "ReplaceOne with document comment"
53 runOnRequirements:
54 - minServerVersion: "4.4"
55 operations:
56 - name: replaceOne
57 object: *collection0
58 arguments:
59 filter: *filter
60 replacement: *replacement
61 comment: &comment { key: "value" }
62 expectEvents:
63 - client: *client0
64 events:
65 - commandStartedEvent:
66 command:
67 update: *collection0Name
68 updates:
69 -
70 q: *filter
71 u: *replacement
72 comment: *comment
73 outcome: *outcome
74
75 - description: "ReplaceOne with comment - pre 4.4"
76 runOnRequirements:
77 - minServerVersion: "3.4.0"
78 maxServerVersion: "4.2.99"
79 operations:
80 - name: replaceOne
81 object: *collection0
82 arguments:
83 filter: *filter
84 replacement: *replacement
85 comment: "comment"
86 expectError:
87 isClientError: false
88 expectEvents:
89 - client: *client0
90 events:
91 - commandStartedEvent:
92 command:
93 update: *collection0Name
94 updates:
95 -
96 q: *filter
97 u: *replacement
98 comment: "comment"
99 outcome: *initialData
View as plain text