...
1# This file was created automatically using mongodb-spec-converter.
2# Please review the generated file, then remove this notice.
3
4description: bulkWrite-arrayFilters
5schemaVersion: '1.0'
6runOnRequirements:
7 -
8 minServerVersion: 3.5.6
9createEntities:
10 -
11 client:
12 id: &client0 client0
13 observeEvents:
14 - commandStartedEvent
15 -
16 database:
17 id: &database0 database0
18 client: client0
19 databaseName: &database_name crud-tests
20 -
21 collection:
22 id: &collection0 collection0
23 database: database0
24 collectionName: &collection_name test
25initialData:
26 -
27 collectionName: *collection_name
28 databaseName: *database_name
29 documents:
30 -
31 _id: 1
32 'y':
33 -
34 b: 3
35 -
36 b: 1
37 -
38 _id: 2
39 'y':
40 -
41 b: 0
42 -
43 b: 1
44tests:
45 -
46 description: 'BulkWrite updateOne with arrayFilters'
47 operations:
48 -
49 object: *collection0
50 name: bulkWrite
51 arguments:
52 requests:
53 -
54 updateOne:
55 filter: { }
56 update:
57 $set:
58 'y.$[i].b': 2
59 arrayFilters:
60 -
61 i.b: 3
62 ordered: true
63 expectResult:
64 deletedCount: 0
65 insertedCount: 0
66 insertedIds: { $$unsetOrMatches: {} }
67 matchedCount: 1
68 modifiedCount: 1
69 upsertedCount: 0
70 upsertedIds: { }
71 expectEvents:
72 -
73 client: *client0
74 events:
75 -
76 commandStartedEvent:
77 command:
78 update: *collection_name
79 updates:
80 -
81 q: { }
82 u:
83 $set: { 'y.$[i].b': 2 }
84 multi: { $$unsetOrMatches: false }
85 upsert: { $$unsetOrMatches: false }
86 arrayFilters:
87 - { i.b: 3 }
88 ordered: true
89 commandName: update
90 databaseName: *database_name
91 outcome:
92 -
93 collectionName: *collection_name
94 databaseName: *database_name
95 documents:
96 -
97 _id: 1
98 'y':
99 -
100 b: 2
101 -
102 b: 1
103 -
104 _id: 2
105 'y':
106 -
107 b: 0
108 -
109 b: 1
110 -
111 description: 'BulkWrite updateMany with arrayFilters'
112 operations:
113 -
114 object: *collection0
115 name: bulkWrite
116 arguments:
117 requests:
118 -
119 updateMany:
120 filter: { }
121 update:
122 $set:
123 'y.$[i].b': 2
124 arrayFilters:
125 -
126 i.b: 1
127 ordered: true
128 expectResult:
129 deletedCount: 0
130 insertedCount: 0
131 insertedIds: { $$unsetOrMatches: {} }
132 matchedCount: 2
133 modifiedCount: 2
134 upsertedCount: 0
135 upsertedIds: { }
136 expectEvents:
137 -
138 client: *client0
139 events:
140 -
141 commandStartedEvent:
142 command:
143 update: *collection_name
144 updates:
145 -
146 q: { }
147 u:
148 $set: { 'y.$[i].b': 2 }
149 multi: true
150 upsert: { $$unsetOrMatches: false }
151 arrayFilters:
152 - { i.b: 1 }
153 ordered: true
154 commandName: update
155 databaseName: *database_name
156 outcome:
157 -
158 collectionName: *collection_name
159 databaseName: *database_name
160 documents:
161 -
162 _id: 1
163 'y':
164 -
165 b: 3
166 -
167 b: 2
168 -
169 _id: 2
170 'y':
171 -
172 b: 0
173 -
174 b: 2
View as plain text