...
1data:
2 - {_id: 1, x: 11}
3 - {_id: 2, x: 'ping'}
4 - {_id: 3, x: 'pINg'}
5 - {_id: 4, x: 'pong'}
6 - {_id: 5, x: 'pONg'}
7
8minServerVersion: '3.4'
9serverless: 'forbid'
10
11# See: https://www.mongodb.com/docs/manual/reference/collation/#collation-document
12tests:
13 -
14 description: "BulkWrite with delete operations and collation"
15 operation:
16 name: "bulkWrite"
17 arguments:
18 requests:
19 -
20 # matches two documents but deletes one
21 name: "deleteOne"
22 arguments:
23 filter: { x: "PING" }
24 collation: { locale: "en_US", strength: 2 }
25 -
26 # matches the remaining document and deletes it
27 name: "deleteOne"
28 arguments:
29 filter: { x: "PING" }
30 collation: { locale: "en_US", strength: 2 }
31 -
32 # matches two documents and deletes them
33 name: "deleteMany"
34 arguments:
35 filter: { x: "PONG" }
36 collation: { locale: "en_US", strength: 2 }
37 options: { ordered: true }
38 outcome:
39 result:
40 deletedCount: 4
41 insertedCount: 0
42 insertedIds: {}
43 matchedCount: 0
44 modifiedCount: 0
45 upsertedCount: 0
46 upsertedIds: {}
47 collection:
48 data:
49 - {_id: 1, x: 11 }
50 -
51 description: "BulkWrite with update operations and collation"
52 operation:
53 name: "bulkWrite"
54 arguments:
55 requests:
56 -
57 # matches only one document due to strength and updates
58 name: "updateMany"
59 arguments:
60 filter: { x: "ping" }
61 update: { $set: { x: "PONG" } }
62 collation: { locale: "en_US", strength: 3 }
63 -
64 # matches one document and updates
65 name: "updateOne"
66 arguments:
67 filter: { x: "ping" }
68 update: { $set: { x: "PONG" } }
69 collation: { locale: "en_US", strength: 2 }
70 -
71 # matches no document due to strength and upserts
72 name: "replaceOne"
73 arguments:
74 filter: { x: "ping" }
75 replacement: { _id: 6, x: "ping" }
76 upsert: true
77 collation: { locale: "en_US", strength: 3 }
78 -
79 # matches two documents and updates
80 name: "updateMany"
81 arguments:
82 filter: { x: "pong" }
83 update: { $set: { x: "PONG" } }
84 collation: { locale: "en_US", strength: 2 }
85 options: { ordered: true }
86 outcome:
87 result:
88 deletedCount: 0
89 insertedCount: 0
90 insertedIds: {}
91 matchedCount: 6
92 modifiedCount: 4
93 upsertedCount: 1
94 upsertedIds: { 2: 6 }
95 collection:
96 data:
97 - {_id: 1, x: 11 }
98 - {_id: 2, x: "PONG" }
99 - {_id: 3, x: "PONG" }
100 - {_id: 4, x: "PONG" }
101 - {_id: 5, x: "PONG" }
102 - {_id: 6, x: "ping" }
View as plain text