...
1description: "bulkWrite-insertOne-dots_and_dollars"
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
23tests:
24 - description: "Inserting document with top-level dollar-prefixed key on 5.0+ server"
25 runOnRequirements:
26 - minServerVersion: "5.0"
27 operations:
28 - name: bulkWrite
29 object: *collection0
30 arguments:
31 requests:
32 - insertOne:
33 document: &dollarPrefixedKey { _id: 1, $a: 1 }
34 expectResult: &bulkWriteResult
35 deletedCount: 0
36 insertedCount: 1
37 insertedIds: { $$unsetOrMatches: { 0: 1 } }
38 matchedCount: 0
39 modifiedCount: 0
40 upsertedCount: 0
41 upsertedIds: { }
42 expectEvents: &expectEventsDollarPrefixedKey
43 - client: *client0
44 events:
45 - commandStartedEvent:
46 command:
47 insert: *collection0Name
48 documents:
49 - *dollarPrefixedKey
50 outcome:
51 - collectionName: *collection0Name
52 databaseName: *database0Name
53 documents:
54 - *dollarPrefixedKey
55
56 - description: "Inserting document with top-level dollar-prefixed key on pre-5.0 server yields server-side error"
57 runOnRequirements:
58 - maxServerVersion: "4.99"
59 operations:
60 - name: bulkWrite
61 object: *collection0
62 arguments:
63 requests:
64 - insertOne:
65 document: *dollarPrefixedKey
66 expectError:
67 isClientError: false
68 expectEvents: *expectEventsDollarPrefixedKey
69 outcome: *initialData
70
71 - description: "Inserting document with top-level dotted key"
72 operations:
73 - name: bulkWrite
74 object: *collection0
75 arguments:
76 requests:
77 - insertOne:
78 document: &dottedKey { _id: 1, a.b: 1 }
79 expectResult: *bulkWriteResult
80 expectEvents:
81 - client: *client0
82 events:
83 - commandStartedEvent:
84 command:
85 insert: *collection0Name
86 documents:
87 - *dottedKey
88 outcome:
89 - collectionName: *collection0Name
90 databaseName: *database0Name
91 documents:
92 - *dottedKey
93
94 - description: "Inserting document with dollar-prefixed key in embedded doc"
95 operations:
96 - name: bulkWrite
97 object: *collection0
98 arguments:
99 requests:
100 - insertOne:
101 document: &dollarPrefixedKeyInEmbedded { _id: 1, a: { $b: 1 } }
102 expectResult: *bulkWriteResult
103 expectEvents:
104 - client: *client0
105 events:
106 - commandStartedEvent:
107 command:
108 insert: *collection0Name
109 documents:
110 - *dollarPrefixedKeyInEmbedded
111 outcome:
112 - collectionName: *collection0Name
113 databaseName: *database0Name
114 documents:
115 - *dollarPrefixedKeyInEmbedded
116
117 - description: "Inserting document with dotted key in embedded doc"
118 operations:
119 - name: bulkWrite
120 object: *collection0
121 arguments:
122 requests:
123 - insertOne:
124 document: &dottedKeyInEmbedded { _id: 1, a: { b.c: 1 } }
125 expectResult: *bulkWriteResult
126 expectEvents:
127 - client: *client0
128 events:
129 - commandStartedEvent:
130 command:
131 insert: *collection0Name
132 documents:
133 - *dottedKeyInEmbedded
134 outcome:
135 - collectionName: *collection0Name
136 databaseName: *database0Name
137 documents:
138 - *dottedKeyInEmbedded
View as plain text