...
1
2
3description: bulkWrite-comment
4schemaVersion: '1.0'
5
6createEntities:
7 - client:
8 id: &client0 client0
9 observeEvents:
10 - commandStartedEvent
11 - database:
12 id: &database0 database0
13 client: client0
14 databaseName: &database_name crud-v2
15 - collection:
16 id: &collection0 collection0
17 database: database0
18 collectionName: &collection_name BulkWrite_comment
19
20initialData: &initial_data
21 - collectionName: *collection_name
22 databaseName: *database_name
23 documents:
24 - _id: 1
25 x: 11
26 - _id: 2
27 x: 22
28 - _id: 3
29 x: 33
30 - _id: 4
31 x: 44
32
33tests:
34 - description: 'BulkWrite with string comment'
35 runOnRequirements:
36 - minServerVersion: "4.4"
37 operations:
38 - object: *collection0
39 name: bulkWrite
40 arguments:
41 requests: &requests
42 - insertOne:
43 document: &inserted_document
44 _id: 5
45 x: "inserted"
46 - replaceOne:
47 filter: &replaceOne_filter
48 _id: 1
49 replacement: &replacement { _id: 1, x: "replaced" }
50 - updateOne:
51 filter: &updateOne_filter
52 _id: 2
53 update: &update { $set: {x: "updated"} }
54 - deleteOne:
55 filter: &deleteOne_filter
56 _id: 3
57 comment: &string_comment "comment"
58 expectResult: &expect_results
59 deletedCount: 1
60 insertedCount: 1
61 insertedIds: { $$unsetOrMatches: { 0: 5} }
62 matchedCount: 2
63 modifiedCount: 2
64 upsertedCount: 0
65 upsertedIds: { }
66 expectEvents:
67 - client: *client0
68 events:
69 - commandStartedEvent:
70 command:
71 insert: *collection_name
72 documents:
73 - *inserted_document
74 ordered: true
75 comment: *string_comment
76 - commandStartedEvent:
77 command:
78 update: *collection_name
79 updates:
80 - q: *replaceOne_filter
81 u: *replacement
82 multi: { $$unsetOrMatches: false }
83 upsert: { $$unsetOrMatches: false }
84 - q: *updateOne_filter
85 u: *update
86 multi: { $$unsetOrMatches: false }
87 upsert: { $$unsetOrMatches: false }
88 ordered: true
89 comment: *string_comment
90 - commandStartedEvent:
91 command:
92 delete: *collection_name
93 deletes:
94 - q: *deleteOne_filter
95 limit: 1
96 ordered: true
97 comment: *string_comment
98 outcome: &outcome
99 - collectionName: *collection_name
100 databaseName: *database_name
101 documents:
102 - _id: 1
103 x: "replaced"
104 - _id: 2
105 x: "updated"
106 - _id: 4
107 x: 44
108 - _id: 5
109 x: "inserted"
110
111 - description: 'BulkWrite with document comment'
112 runOnRequirements:
113 - minServerVersion: "4.4"
114 operations:
115 - object: *collection0
116 name: bulkWrite
117 arguments:
118 requests: *requests
119 comment: &document_comment { key: "value" }
120 expectResult: *expect_results
121 expectEvents:
122 - client: *client0
123 events:
124 - commandStartedEvent:
125 command:
126 insert: *collection_name
127 documents:
128 - *inserted_document
129 ordered: true
130 comment: *document_comment
131 - commandStartedEvent:
132 command:
133 update: *collection_name
134 updates:
135 - q: *replaceOne_filter
136 u: *replacement
137 multi: { $$unsetOrMatches: false }
138 upsert: { $$unsetOrMatches: false }
139 - q: *updateOne_filter
140 u: *update
141 multi: { $$unsetOrMatches: false }
142 upsert: { $$unsetOrMatches: false }
143 ordered: true
144 comment: *document_comment
145 - commandStartedEvent:
146 command:
147 delete: *collection_name
148 deletes:
149 - q: *deleteOne_filter
150 limit: 1
151 ordered: true
152 comment: *document_comment
153 outcome: *outcome
154
155 - description: 'BulkWrite with comment - pre 4.4'
156 runOnRequirements:
157 - minServerVersion: "3.4.0"
158 maxServerVersion: "4.2.99"
159 operations:
160 - object: *collection0
161 name: bulkWrite
162 arguments:
163 requests: *requests
164 comment: "comment"
165 expectError:
166 isClientError: false
167 expectEvents:
168 - client: *client0
169 events:
170 - commandStartedEvent:
171 command:
172 insert: *collection_name
173 documents:
174 - *inserted_document
175 ordered: true
176 comment: "comment"
177 outcome: *initial_data
View as plain text