mongo 2.18.0.beta1 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/lib/mongo/bulk_write.rb +8 -2
  4. data/lib/mongo/client.rb +19 -5
  5. data/lib/mongo/client_encryption.rb +86 -4
  6. data/lib/mongo/cluster.rb +6 -4
  7. data/lib/mongo/collection/view/aggregation.rb +3 -0
  8. data/lib/mongo/collection/view/change_stream.rb +9 -0
  9. data/lib/mongo/collection/view/iterable.rb +1 -0
  10. data/lib/mongo/collection/view/readable.rb +11 -3
  11. data/lib/mongo/collection.rb +9 -1
  12. data/lib/mongo/config.rb +11 -0
  13. data/lib/mongo/crypt/auto_encrypter.rb +49 -21
  14. data/lib/mongo/crypt/binding.rb +73 -48
  15. data/lib/mongo/crypt/data_key_context.rb +6 -1
  16. data/lib/mongo/crypt/encryption_io.rb +66 -0
  17. data/lib/mongo/crypt/explicit_encrypter.rb +116 -5
  18. data/lib/mongo/crypt/explicit_encryption_context.rb +3 -8
  19. data/lib/mongo/crypt/handle.rb +26 -8
  20. data/lib/mongo/crypt/kms/aws.rb +11 -3
  21. data/lib/mongo/crypt/kms/azure.rb +14 -6
  22. data/lib/mongo/crypt/kms/gcp.rb +12 -5
  23. data/lib/mongo/crypt/kms/kmip.rb +15 -9
  24. data/lib/mongo/crypt/kms/local.rb +9 -1
  25. data/lib/mongo/crypt/kms/master_key_document.rb +1 -1
  26. data/lib/mongo/crypt/rewrap_many_data_key_context.rb +46 -0
  27. data/lib/mongo/crypt/rewrap_many_data_key_result.rb +37 -0
  28. data/lib/mongo/crypt/status.rb +8 -2
  29. data/lib/mongo/crypt.rb +2 -0
  30. data/lib/mongo/database.rb +10 -27
  31. data/lib/mongo/error/missing_file_chunk.rb +8 -2
  32. data/lib/mongo/grid/stream/read.rb +6 -0
  33. data/lib/mongo/index/view.rb +1 -0
  34. data/lib/mongo/operation/create/op_msg.rb +1 -13
  35. data/lib/mongo/operation/distinct/op_msg.rb +4 -1
  36. data/lib/mongo/protocol/msg.rb +0 -16
  37. data/lib/mongo/server/connection_pool.rb +5 -4
  38. data/lib/mongo/server/monitor/connection.rb +10 -4
  39. data/lib/mongo/server/monitor.rb +4 -0
  40. data/lib/mongo/server/push_monitor.rb +4 -0
  41. data/lib/mongo/version.rb +1 -1
  42. data/lib/mongo.rb +2 -0
  43. data/spec/README.md +14 -0
  44. data/spec/integration/change_stream_spec.rb +1 -1
  45. data/spec/integration/client_construction_spec.rb +73 -7
  46. data/spec/integration/client_side_encryption/auto_encryption_command_monitoring_spec.rb +165 -164
  47. data/spec/integration/client_side_encryption/decryption_events_prose_spec.rb +158 -0
  48. data/spec/integration/client_side_encryption/explicit_queryable_encryption_spec.rb +5 -5
  49. data/spec/integration/client_side_encryption/kms_tls_options_spec.rb +50 -8
  50. data/spec/integration/client_side_encryption/unique_index_on_key_alt_names_prose_spec.rb +85 -0
  51. data/spec/integration/ocsp_verifier_spec.rb +1 -1
  52. data/spec/integration/reconnect_spec.rb +2 -0
  53. data/spec/integration/sdam_events_spec.rb +40 -0
  54. data/spec/integration/srv_monitoring_spec.rb +1 -0
  55. data/spec/integration/srv_spec.rb +1 -0
  56. data/spec/lite_spec_helper.rb +5 -4
  57. data/spec/mongo/bulk_write_spec.rb +13 -0
  58. data/spec/mongo/client_construction_spec.rb +45 -2
  59. data/spec/mongo/client_encryption_spec.rb +0 -12
  60. data/spec/mongo/client_spec.rb +1 -1
  61. data/spec/mongo/collection/view/aggregation_spec.rb +119 -0
  62. data/spec/mongo/collection/view/readable_spec.rb +630 -5
  63. data/spec/mongo/collection_spec.rb +32 -0
  64. data/spec/mongo/crypt/auto_encrypter_spec.rb +110 -0
  65. data/spec/mongo/crypt/binding/context_spec.rb +3 -35
  66. data/spec/mongo/crypt/data_key_context_spec.rb +1 -1
  67. data/spec/mongo/crypt/explicit_encryption_context_spec.rb +8 -3
  68. data/spec/mongo/crypt/handle_spec.rb +39 -3
  69. data/spec/mongo/crypt/kms/credentials_spec.rb +0 -47
  70. data/spec/mongo/index/view_spec.rb +56 -0
  71. data/spec/mongo/operation/create/op_msg_spec.rb +0 -42
  72. data/spec/mongo/server/connection_pool_spec.rb +26 -4
  73. data/spec/mongo/socket/ssl_spec.rb +3 -3
  74. data/spec/runners/crud/requirement.rb +6 -1
  75. data/spec/runners/crud/test.rb +1 -1
  76. data/spec/runners/transactions/spec.rb +2 -2
  77. data/spec/runners/transactions/test.rb +4 -20
  78. data/spec/runners/transactions.rb +2 -2
  79. data/spec/runners/unified/assertions.rb +32 -2
  80. data/spec/runners/unified/change_stream_operations.rb +3 -0
  81. data/spec/runners/unified/client_side_encryption_operations.rb +83 -0
  82. data/spec/runners/unified/crud_operations.rb +17 -2
  83. data/spec/runners/unified/ddl_operations.rb +27 -2
  84. data/spec/runners/unified/grid_fs_operations.rb +21 -0
  85. data/spec/runners/unified/test.rb +59 -1
  86. data/spec/shared/lib/mrss/docker_runner.rb +2 -0
  87. data/spec/shared/lib/mrss/eg_config_utils.rb +51 -0
  88. data/spec/shared/lib/mrss/lite_constraints.rb +10 -2
  89. data/spec/shared/shlib/set_env.sh +3 -0
  90. data/spec/solo/clean_exit_spec.rb +5 -0
  91. data/spec/spec_tests/client_side_encryption_spec.rb +1 -1
  92. data/spec/spec_tests/client_side_encryption_unified_spec.rb +16 -0
  93. data/spec/spec_tests/data/change_streams_unified/change-streams-showExpandedEvents.yml +298 -0
  94. data/spec/spec_tests/data/client_side_encryption/create-and-createIndexes.yml +58 -0
  95. data/spec/spec_tests/data/client_side_encryption/fle2-Delete.yml +1 -1
  96. data/spec/spec_tests/data/client_side_encryption/fle2-EncryptedFields-vs-jsonSchema.yml +1 -1
  97. data/spec/spec_tests/data/client_side_encryption/fle2-FindOneAndUpdate.yml +2 -2
  98. data/spec/spec_tests/data/client_side_encryption/fle2-InsertFind-Indexed.yml +1 -1
  99. data/spec/spec_tests/data/client_side_encryption/fle2-Update.yml +2 -2
  100. data/spec/spec_tests/data/client_side_encryption/unified/addKeyAltName.yml +194 -0
  101. data/spec/spec_tests/data/client_side_encryption/unified/createDataKey-kms_providers-invalid.yml +67 -0
  102. data/spec/spec_tests/data/client_side_encryption/unified/createDataKey.yml +309 -0
  103. data/spec/spec_tests/data/client_side_encryption/unified/deleteKey.yml +159 -0
  104. data/spec/spec_tests/data/client_side_encryption/unified/getKey.yml +105 -0
  105. data/spec/spec_tests/data/client_side_encryption/unified/getKeyByAltName.yml +104 -0
  106. data/spec/spec_tests/data/client_side_encryption/unified/getKeys.yml +122 -0
  107. data/spec/spec_tests/data/client_side_encryption/unified/removeKeyAltName.yml +157 -0
  108. data/spec/spec_tests/data/client_side_encryption/unified/rewrapManyDataKey-decrypt_failure.yml +69 -0
  109. data/spec/spec_tests/data/client_side_encryption/unified/rewrapManyDataKey-encrypt_failure.yml +122 -0
  110. data/spec/spec_tests/data/client_side_encryption/unified/rewrapManyDataKey.yml +432 -0
  111. data/spec/spec_tests/data/client_side_encryption/validatorAndPartialFieldExpression.yml +166 -0
  112. data/spec/spec_tests/data/command_monitoring_unified/bulkWrite.yml +68 -0
  113. data/spec/spec_tests/data/command_monitoring_unified/command.yml +50 -0
  114. data/spec/spec_tests/data/command_monitoring_unified/deleteMany.yml +79 -0
  115. data/spec/spec_tests/data/command_monitoring_unified/deleteOne.yml +79 -0
  116. data/spec/spec_tests/data/command_monitoring_unified/find.yml +254 -0
  117. data/spec/spec_tests/data/command_monitoring_unified/insertMany.yml +79 -0
  118. data/spec/spec_tests/data/command_monitoring_unified/insertOne.yml +77 -0
  119. data/spec/spec_tests/data/command_monitoring_unified/unacknowledgedBulkWrite.yml +55 -0
  120. data/spec/spec_tests/data/command_monitoring_unified/updateMany.yml +87 -0
  121. data/spec/spec_tests/data/command_monitoring_unified/updateOne.yml +118 -0
  122. data/spec/spec_tests/data/crud_unified/distinct-comment.yml +98 -0
  123. data/spec/spec_tests/data/gridfs_unified/delete.yml +198 -0
  124. data/spec/spec_tests/data/gridfs_unified/download.yml +241 -0
  125. data/spec/spec_tests/data/gridfs_unified/downloadByName.yml +159 -0
  126. data/spec/spec_tests/data/gridfs_unified/upload-disableMD5.yml +92 -0
  127. data/spec/spec_tests/data/gridfs_unified/upload.yml +288 -0
  128. data/spec/spec_tests/gridfs_unified_spec.rb +13 -0
  129. data/spec/stress/connection_pool_timing_spec.rb +2 -2
  130. data/spec/support/background_thread_registry.rb +3 -13
  131. data/spec/support/certificates/atlas-ocsp-ca.crt +40 -47
  132. data/spec/support/certificates/atlas-ocsp.crt +101 -106
  133. data/spec/support/crypt.rb +57 -13
  134. data/spec/support/macros.rb +10 -0
  135. data/spec/support/spec_config.rb +4 -0
  136. data.tar.gz.sig +0 -0
  137. metadata +1271 -1219
  138. metadata.gz.sig +0 -0
  139. data/spec/spec_tests/command_monitoring_spec.rb +0 -71
  140. data/spec/spec_tests/data/command_monitoring/bulkWrite.yml +0 -49
  141. data/spec/spec_tests/data/command_monitoring/command.yml +0 -61
  142. data/spec/spec_tests/data/command_monitoring/deleteMany.yml +0 -55
  143. data/spec/spec_tests/data/command_monitoring/deleteOne.yml +0 -55
  144. data/spec/spec_tests/data/command_monitoring/find.yml +0 -266
  145. data/spec/spec_tests/data/command_monitoring/insertMany.yml +0 -75
  146. data/spec/spec_tests/data/command_monitoring/insertOne.yml +0 -51
  147. data/spec/spec_tests/data/command_monitoring/unacknowledgedBulkWrite.yml +0 -34
  148. data/spec/spec_tests/data/command_monitoring/updateMany.yml +0 -65
  149. data/spec/spec_tests/data/command_monitoring/updateOne.yml +0 -90
@@ -0,0 +1,50 @@
1
+ description: "command"
2
+
3
+ schemaVersion: "1.0"
4
+
5
+ createEntities:
6
+ - client:
7
+ id: &client client
8
+ observeEvents:
9
+ - commandStartedEvent
10
+ - commandSucceededEvent
11
+ - commandFailedEvent
12
+ - database:
13
+ id: &database database
14
+ client: *client
15
+ databaseName: &databaseName command-monitoring-tests
16
+ - collection:
17
+ id: &collection collection
18
+ database: *database
19
+ collectionName: &collectionName test
20
+
21
+ initialData:
22
+ - collectionName: *collectionName
23
+ databaseName: *databaseName
24
+ documents:
25
+ - { _id: 1, x: 11 }
26
+
27
+ tests:
28
+ - description: "A successful command"
29
+ operations:
30
+ - name: runCommand
31
+ object: *database
32
+ arguments:
33
+ command: { ping: 1 }
34
+ commandName: ping
35
+ expectEvents:
36
+ - client: *client
37
+ events:
38
+ - commandStartedEvent:
39
+ command:
40
+ ping: 1
41
+ commandName: ping
42
+ databaseName: *databaseName
43
+ - commandSucceededEvent:
44
+ reply:
45
+ ok: 1
46
+ commandName: ping
47
+
48
+ # The legacy "A failed command event" test was removed in the test conversion, as the
49
+ # behavior when a command fails is already covered by the test "A failed find event"
50
+ # in find.yml.
@@ -0,0 +1,79 @@
1
+ description: "deleteMany"
2
+
3
+ schemaVersion: "1.0"
4
+
5
+ createEntities:
6
+ - client:
7
+ id: &client client
8
+ observeEvents:
9
+ - commandStartedEvent
10
+ - commandSucceededEvent
11
+ - commandFailedEvent
12
+ - database:
13
+ id: &database database
14
+ client: *client
15
+ databaseName: &databaseName command-monitoring-tests
16
+ - collection:
17
+ id: &collection collection
18
+ database: *database
19
+ collectionName: &collectionName test
20
+
21
+ initialData:
22
+ - collectionName: *collectionName
23
+ databaseName: *databaseName
24
+ documents:
25
+ - { _id: 1, x: 11 }
26
+ - { _id: 2, x: 22 }
27
+ - { _id: 3, x: 33 }
28
+
29
+ tests:
30
+ - description: "A successful deleteMany"
31
+ operations:
32
+ - name: deleteMany
33
+ object: *collection
34
+ arguments:
35
+ filter: { _id: { $gt: 1 } }
36
+ expectEvents:
37
+ - client: *client
38
+ events:
39
+ - commandStartedEvent:
40
+ command:
41
+ delete: *collectionName
42
+ deletes:
43
+ - { q: { _id: { $gt: 1 }}, limit: 0 }
44
+ ordered: true
45
+ commandName: delete
46
+ databaseName: *databaseName
47
+ - commandSucceededEvent:
48
+ reply: { ok: 1, n: 2 }
49
+ commandName: delete
50
+
51
+ - description: "A successful deleteMany with write errors"
52
+ operations:
53
+ - name: deleteMany
54
+ object: *collection
55
+ arguments:
56
+ filter: { _id: { $unsupported: 1 } }
57
+ expectError:
58
+ isClientError: false
59
+ expectEvents:
60
+ - client: *client
61
+ events:
62
+ - commandStartedEvent:
63
+ command:
64
+ delete: *collectionName
65
+ deletes:
66
+ - { q: { _id: { $unsupported: 1 }}, limit: 0 }
67
+ ordered: true
68
+ commandName: delete
69
+ databaseName: *databaseName
70
+ - commandSucceededEvent:
71
+ reply:
72
+ ok: 1
73
+ n: 0
74
+ # The legacy version of this test included an assertion that writeErrors contained a single document
75
+ # with index=0, a "code" value, and a non-empty "errmsg". However, writeErrors can contain extra fields
76
+ # beyond these, and the unified format currently does not permit allowing extra fields in sub-documents,
77
+ # so those assertions are not present here.
78
+ writeErrors: { $$type: array }
79
+ commandName: delete
@@ -0,0 +1,79 @@
1
+ description: "deleteOne"
2
+
3
+ schemaVersion: "1.0"
4
+
5
+ createEntities:
6
+ - client:
7
+ id: &client client
8
+ observeEvents:
9
+ - commandStartedEvent
10
+ - commandSucceededEvent
11
+ - commandFailedEvent
12
+ - database:
13
+ id: &database database
14
+ client: *client
15
+ databaseName: &databaseName command-monitoring-tests
16
+ - collection:
17
+ id: &collection collection
18
+ database: *database
19
+ collectionName: &collectionName test
20
+
21
+ initialData:
22
+ - collectionName: *collectionName
23
+ databaseName: *databaseName
24
+ documents:
25
+ - { _id: 1, x: 11 }
26
+ - { _id: 2, x: 22 }
27
+ - { _id: 3, x: 33 }
28
+
29
+ tests:
30
+ - description: "A successful deleteOne"
31
+ operations:
32
+ - name: deleteOne
33
+ object: *collection
34
+ arguments:
35
+ filter: { _id: { $gt: 1 } }
36
+ expectEvents:
37
+ - client: *client
38
+ events:
39
+ - commandStartedEvent:
40
+ command:
41
+ delete: *collectionName
42
+ deletes:
43
+ - { q: { _id: { $gt: 1 }}, limit: 1 }
44
+ ordered: true
45
+ commandName: delete
46
+ databaseName: *databaseName
47
+ - commandSucceededEvent:
48
+ reply: { ok: 1, n: 1 }
49
+ commandName: delete
50
+
51
+ - description: "A successful deleteOne with write errors"
52
+ operations:
53
+ - name: deleteOne
54
+ object: *collection
55
+ arguments:
56
+ filter: { _id: { $unsupported: 1 } }
57
+ expectError:
58
+ isClientError: false
59
+ expectEvents:
60
+ - client: *client
61
+ events:
62
+ - commandStartedEvent:
63
+ command:
64
+ delete: *collectionName
65
+ deletes:
66
+ - { q: { _id: { $unsupported: 1 }}, limit: 1 }
67
+ ordered: true
68
+ commandName: delete
69
+ databaseName: *databaseName
70
+ - commandSucceededEvent:
71
+ reply:
72
+ ok: 1
73
+ n: 0
74
+ # The legacy version of this test included an assertion that writeErrors contained a single document
75
+ # with index=0, a "code" value, and a non-empty "errmsg". However, writeErrors can contain extra fields
76
+ # beyond these, and the unified format currently does not permit allowing extra fields in sub-documents,
77
+ # so those assertions are not present here.
78
+ writeErrors: { $$type: array }
79
+ commandName: delete
@@ -0,0 +1,254 @@
1
+ description: "find"
2
+
3
+ schemaVersion: "1.1"
4
+
5
+ createEntities:
6
+ - client:
7
+ id: &client client
8
+ observeEvents:
9
+ - commandStartedEvent
10
+ - commandSucceededEvent
11
+ - commandFailedEvent
12
+ - database:
13
+ id: &database database
14
+ client: *client
15
+ databaseName: &databaseName command-monitoring-tests
16
+ - collection:
17
+ id: &collection collection
18
+ database: *database
19
+ collectionName: &collectionName test
20
+
21
+ _yamlAnchors:
22
+ namespace: &namespace "command-monitoring-tests.test"
23
+
24
+ initialData:
25
+ - collectionName: *collectionName
26
+ databaseName: *databaseName
27
+ documents:
28
+ - { _id: 1, x: 11 }
29
+ - { _id: 2, x: 22 }
30
+ - { _id: 3, x: 33 }
31
+ - { _id: 4, x: 44 }
32
+ - { _id: 5, x: 55 }
33
+
34
+ tests:
35
+ - description: "A successful find with no options"
36
+ operations:
37
+ - name: find
38
+ object: *collection
39
+ arguments:
40
+ filter: { _id: 1 }
41
+ expectEvents:
42
+ - client: *client
43
+ events:
44
+ - commandStartedEvent:
45
+ command:
46
+ find: *collectionName
47
+ filter: { _id: 1 }
48
+ commandName: find
49
+ databaseName: *databaseName
50
+ - commandSucceededEvent:
51
+ reply:
52
+ ok: 1
53
+ cursor:
54
+ id: 0
55
+ ns: *namespace
56
+ firstBatch:
57
+ - { _id: 1, x: 11 }
58
+ commandName: find
59
+
60
+ - description: "A successful find with options"
61
+ operations:
62
+ - name: find
63
+ object: *collection
64
+ arguments:
65
+ filter: { _id: { $gt: 1 } }
66
+ sort: { x: -1 }
67
+ projection: { _id: 0, x: 1 }
68
+ skip: 2
69
+ comment: "test"
70
+ hint: { _id: 1 }
71
+ max: { _id: 6 }
72
+ maxTimeMS: 6000
73
+ min: { _id: 0 }
74
+ expectEvents:
75
+ - client: *client
76
+ events:
77
+ - commandStartedEvent:
78
+ command:
79
+ find: *collectionName
80
+ filter: { _id: { $gt: 1 } }
81
+ sort: { x: -1 }
82
+ projection: { _id: 0, x: 1 }
83
+ skip: 2
84
+ comment: "test"
85
+ hint: { _id: 1 }
86
+ max: { _id: 6 }
87
+ maxTimeMS: 6000
88
+ min: { _id: 0 }
89
+ commandName: find
90
+ databaseName: *databaseName
91
+ - commandSucceededEvent:
92
+ reply:
93
+ ok: 1
94
+ cursor:
95
+ id: 0
96
+ ns: *namespace
97
+ firstBatch:
98
+ - { x: 33 }
99
+ - { x: 22 }
100
+ commandName: find
101
+
102
+ - description: "A successful find with showRecordId and returnKey"
103
+ operations:
104
+ - name: find
105
+ object: *collection
106
+ arguments:
107
+ filter: { }
108
+ sort: { _id: 1 }
109
+ showRecordId: true
110
+ returnKey: true
111
+ expectEvents:
112
+ - client: *client
113
+ events:
114
+ - commandStartedEvent:
115
+ command:
116
+ find: *collectionName
117
+ showRecordId: true
118
+ returnKey: true
119
+ commandName: find
120
+ databaseName: *databaseName
121
+ - commandSucceededEvent:
122
+ reply:
123
+ ok: 1
124
+ cursor:
125
+ id: 0
126
+ ns: *namespace
127
+ firstBatch:
128
+ - { _id: 1 }
129
+ - { _id: 2 }
130
+ - { _id: 3 }
131
+ - { _id: 4 }
132
+ - { _id: 5 }
133
+ commandName: find
134
+
135
+ - description: "A successful find with a getMore"
136
+ operations:
137
+ - name: find
138
+ object: *collection
139
+ arguments:
140
+ filter: { _id: { $gte: 1 }}
141
+ sort: { _id: 1 }
142
+ batchSize: 3
143
+ expectEvents:
144
+ - client: *client
145
+ events:
146
+ - commandStartedEvent:
147
+ command:
148
+ find: *collectionName
149
+ filter: { _id: { $gte: 1 }}
150
+ sort: { _id: 1 }
151
+ batchSize: 3
152
+ commandName: find
153
+ databaseName: *databaseName
154
+ - commandSucceededEvent:
155
+ reply:
156
+ ok: 1
157
+ cursor:
158
+ id: { $$type: [ int, long ] }
159
+ ns: *namespace
160
+ firstBatch:
161
+ - { _id: 1, x: 11 }
162
+ - { _id: 2, x: 22 }
163
+ - { _id: 3, x: 33 }
164
+ commandName: find
165
+ - commandStartedEvent:
166
+ command:
167
+ getMore: { $$type: [ int, long ] }
168
+ collection: *collectionName
169
+ batchSize: 3
170
+ commandName: getMore
171
+ databaseName: *databaseName
172
+ - commandSucceededEvent:
173
+ reply:
174
+ ok: 1
175
+ cursor:
176
+ id: 0
177
+ ns: *namespace
178
+ nextBatch:
179
+ - { _id: 4, x: 44 }
180
+ - { _id: 5, x: 55 }
181
+ commandName: getMore
182
+
183
+ - description: "A successful find event with a getmore and the server kills the cursor (<= 4.4)"
184
+ runOnRequirements:
185
+ - minServerVersion: "3.1"
186
+ maxServerVersion: "4.4.99"
187
+ topologies: [ single, replicaset ]
188
+ operations:
189
+ - name: find
190
+ object: *collection
191
+ arguments:
192
+ filter: { _id: { $gte: 1 } }
193
+ sort: { _id: 1 }
194
+ batchSize: 3
195
+ limit: 4
196
+ expectEvents:
197
+ - client: *client
198
+ events:
199
+ - commandStartedEvent:
200
+ command:
201
+ find: *collectionName
202
+ filter: { _id: { $gte: 1 } }
203
+ sort: { _id: 1 }
204
+ batchSize: 3
205
+ limit: 4
206
+ commandName: find
207
+ databaseName: *databaseName
208
+ - commandSucceededEvent:
209
+ reply:
210
+ ok: 1
211
+ cursor:
212
+ id: { $$type: [ int, long ] }
213
+ ns: *namespace
214
+ firstBatch:
215
+ - { _id: 1, x: 11 }
216
+ - { _id: 2, x: 22 }
217
+ - { _id: 3, x: 33 }
218
+ commandName: find
219
+ - commandStartedEvent:
220
+ command:
221
+ getMore: { $$type: [ int, long ] }
222
+ collection: *collectionName
223
+ batchSize: 1
224
+ commandName: getMore
225
+ databaseName: *databaseName
226
+ - commandSucceededEvent:
227
+ reply:
228
+ ok: 1
229
+ cursor:
230
+ id: 0
231
+ ns: *namespace
232
+ nextBatch:
233
+ - { _id: 4, x: 44 }
234
+ commandName: getMore
235
+
236
+ - description: "A failed find event"
237
+ operations:
238
+ - name: find
239
+ object: *collection
240
+ arguments:
241
+ filter: { $or: true }
242
+ expectError:
243
+ isClientError: false
244
+ expectEvents:
245
+ - client: *client
246
+ events:
247
+ - commandStartedEvent:
248
+ command:
249
+ find: *collectionName
250
+ filter: { $or: true }
251
+ commandName: find
252
+ databaseName: *databaseName
253
+ - commandFailedEvent:
254
+ commandName: find
@@ -0,0 +1,79 @@
1
+ description: "insertMany"
2
+
3
+ schemaVersion: "1.0"
4
+
5
+ createEntities:
6
+ - client:
7
+ id: &client client
8
+ observeEvents:
9
+ - commandStartedEvent
10
+ - commandSucceededEvent
11
+ - commandFailedEvent
12
+ - database:
13
+ id: &database database
14
+ client: *client
15
+ databaseName: &databaseName command-monitoring-tests
16
+ - collection:
17
+ id: &collection collection
18
+ database: *database
19
+ collectionName: &collectionName test
20
+
21
+ initialData:
22
+ - collectionName: *collectionName
23
+ databaseName: *databaseName
24
+ documents:
25
+ - { _id: 1, x: 11 }
26
+
27
+ tests:
28
+ - description: "A successful insertMany"
29
+ operations:
30
+ - name: insertMany
31
+ object: *collection
32
+ arguments:
33
+ documents:
34
+ - { _id: 2, x: 22 }
35
+ expectEvents:
36
+ - client: *client
37
+ events:
38
+ - commandStartedEvent:
39
+ command:
40
+ insert: *collectionName
41
+ documents:
42
+ - { _id: 2, x: 22 }
43
+ ordered: true
44
+ commandName: insert
45
+ databaseName: *databaseName
46
+ - commandSucceededEvent:
47
+ reply: { ok: 1, n: 1 }
48
+ commandName: insert
49
+
50
+ - description: "A successful insertMany with write errors"
51
+ operations:
52
+ - name: insertMany
53
+ object: *collection
54
+ arguments:
55
+ documents:
56
+ - { _id: 1, x: 11 }
57
+ expectError:
58
+ isClientError: false
59
+ expectEvents:
60
+ - client: *client
61
+ events:
62
+ - commandStartedEvent:
63
+ command:
64
+ insert: *collectionName
65
+ documents:
66
+ - { _id: 1, x: 11 }
67
+ ordered: true
68
+ commandName: insert
69
+ databaseName: *databaseName
70
+ - commandSucceededEvent:
71
+ reply:
72
+ ok: 1
73
+ n: 0
74
+ # The legacy version of this test included an assertion that writeErrors contained a single document
75
+ # with index=0, a "code" value, and a non-empty "errmsg". However, writeErrors can contain extra fields
76
+ # beyond these, and the unified format currently does not permit allowing extra fields in sub-documents,
77
+ # so those assertions are not present here.
78
+ writeErrors: { $$type: array }
79
+ commandName: insert
@@ -0,0 +1,77 @@
1
+ description: "insertOne"
2
+
3
+ schemaVersion: "1.0"
4
+
5
+ createEntities:
6
+ - client:
7
+ id: &client client
8
+ observeEvents:
9
+ - commandStartedEvent
10
+ - commandSucceededEvent
11
+ - commandFailedEvent
12
+ - database:
13
+ id: &database database
14
+ client: *client
15
+ databaseName: &databaseName command-monitoring-tests
16
+ - collection:
17
+ id: &collection collection
18
+ database: *database
19
+ collectionName: &collectionName test
20
+
21
+ initialData:
22
+ - collectionName: *collectionName
23
+ databaseName: *databaseName
24
+ documents:
25
+ - { _id: 1, x: 11 }
26
+
27
+ tests:
28
+ - description: "A successful insertOne"
29
+ operations:
30
+ - name: insertOne
31
+ object: *collection
32
+ arguments:
33
+ document: { _id: 2, x: 22 }
34
+ expectEvents:
35
+ - client: *client
36
+ events:
37
+ - commandStartedEvent:
38
+ command:
39
+ insert: *collectionName
40
+ documents:
41
+ - { _id: 2, x: 22 }
42
+ ordered: true
43
+ commandName: insert
44
+ databaseName: *databaseName
45
+ - commandSucceededEvent:
46
+ reply: { ok: 1, n: 1 }
47
+ commandName: insert
48
+
49
+ - description: "A successful insertOne with write errors"
50
+ operations:
51
+ - name: insertOne
52
+ object: *collection
53
+ arguments:
54
+ document: { _id: 1, x: 11 }
55
+ expectError:
56
+ isClientError: false
57
+ expectEvents:
58
+ - client: *client
59
+ events:
60
+ - commandStartedEvent:
61
+ command:
62
+ insert: *collectionName
63
+ documents:
64
+ - { _id: 1, x: 11 }
65
+ ordered: true
66
+ commandName: insert
67
+ databaseName: *databaseName
68
+ - commandSucceededEvent:
69
+ reply:
70
+ ok: 1
71
+ n: 0
72
+ # The legacy version of this test included an assertion that writeErrors contained a single document
73
+ # with index=0, a "code" value, and a non-empty "errmsg". However, writeErrors can contain extra fields
74
+ # beyond these, and the unified format currently does not permit allowing extra fields in sub-documents,
75
+ # so those assertions are not present here.
76
+ writeErrors: { $$type: array }
77
+ commandName: insert
@@ -0,0 +1,55 @@
1
+ description: "unacknowledgedBulkWrite"
2
+
3
+ schemaVersion: "1.0"
4
+
5
+ createEntities:
6
+ - client:
7
+ id: &client client
8
+ observeEvents:
9
+ - commandStartedEvent
10
+ - commandSucceededEvent
11
+ - commandFailedEvent
12
+ - database:
13
+ id: &database database
14
+ client: *client
15
+ databaseName: &databaseName command-monitoring-tests
16
+ - collection:
17
+ id: &collection collection
18
+ database: *database
19
+ collectionName: &collectionName test
20
+ collectionOptions:
21
+ writeConcern: { w: 0 }
22
+
23
+ initialData:
24
+ - collectionName: *collectionName
25
+ databaseName: *databaseName
26
+ documents:
27
+ - { _id: 1, x: 11 }
28
+
29
+ tests:
30
+ - description: "A successful unordered bulk write with an unacknowledged write concern"
31
+ operations:
32
+ - name: bulkWrite
33
+ object: *collection
34
+ arguments:
35
+ requests:
36
+ - insertOne:
37
+ document: { _id: "unorderedBulkWriteInsertW0", x: 44 }
38
+ ordered: false
39
+ expectEvents:
40
+ - client: *client
41
+ events:
42
+ - commandStartedEvent:
43
+ command:
44
+ insert: *collectionName
45
+ documents:
46
+ - { _id: "unorderedBulkWriteInsertW0", x: 44 }
47
+ ordered: false
48
+ writeConcern: { w: 0 }
49
+ commandName: insert
50
+ databaseName: *databaseName
51
+ - commandSucceededEvent:
52
+ reply:
53
+ ok: 1
54
+ n: { $$exists: false }
55
+ commandName: insert