mongo 2.21.0 → 2.21.1

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 (1428) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/mongo/auth/aws/conversation.rb +1 -1
  4. data/lib/mongo/auth/credential_cache.rb +13 -6
  5. data/lib/mongo/client.rb +75 -28
  6. data/lib/mongo/client_encryption.rb +1 -1
  7. data/lib/mongo/cluster/sdam_flow.rb +1 -1
  8. data/lib/mongo/collection/view/aggregation.rb +1 -1
  9. data/lib/mongo/crypt/binary.rb +5 -5
  10. data/lib/mongo/crypt/binding.rb +65 -1
  11. data/lib/mongo/crypt/context.rb +55 -27
  12. data/lib/mongo/crypt/encryption_io.rb +4 -2
  13. data/lib/mongo/crypt/handle.rb +1 -1
  14. data/lib/mongo/cursor.rb +1 -1
  15. data/lib/mongo/error/kms_error.rb +9 -0
  16. data/lib/mongo/error/pool_cleared_error.rb +1 -0
  17. data/lib/mongo/error/sdam_error_detection.rb +3 -3
  18. data/lib/mongo/lint.rb +1 -1
  19. data/lib/mongo/monitoring/event/secure.rb +1 -1
  20. data/lib/mongo/monitoring.rb +1 -1
  21. data/lib/mongo/operation/shared/read_preference_supported.rb +2 -2
  22. data/lib/mongo/operation/shared/sessions_supported.rb +2 -2
  23. data/lib/mongo/protocol/compressed.rb +1 -1
  24. data/lib/mongo/protocol/msg.rb +1 -1
  25. data/lib/mongo/search_index/view.rb +4 -4
  26. data/lib/mongo/server/push_monitor.rb +1 -1
  27. data/lib/mongo/session/server_session/dirtyable.rb +1 -1
  28. data/lib/mongo/socket.rb +29 -22
  29. data/lib/mongo/uri/srv_protocol.rb +3 -1
  30. data/lib/mongo/version.rb +1 -1
  31. data/mongo.gemspec +4 -4
  32. metadata +19 -2799
  33. data/Rakefile +0 -196
  34. data/spec/NOTES.aws-auth.md +0 -296
  35. data/spec/README.aws-auth.md +0 -318
  36. data/spec/README.md +0 -733
  37. data/spec/USERS.md +0 -72
  38. data/spec/atlas/atlas_connectivity_spec.rb +0 -27
  39. data/spec/atlas/operations_spec.rb +0 -23
  40. data/spec/faas/ruby-sam-app/Gemfile +0 -9
  41. data/spec/faas/ruby-sam-app/mongodb/Gemfile +0 -4
  42. data/spec/faas/ruby-sam-app/mongodb/app.rb +0 -149
  43. data/spec/faas/ruby-sam-app/template.yaml +0 -48
  44. data/spec/integration/auth_spec.rb +0 -309
  45. data/spec/integration/awaited_ismaster_spec.rb +0 -31
  46. data/spec/integration/aws_auth_credentials_cache_spec.rb +0 -51
  47. data/spec/integration/aws_auth_request_spec.rb +0 -77
  48. data/spec/integration/aws_credentials_retriever_spec.rb +0 -136
  49. data/spec/integration/aws_lambda_examples_spec.rb +0 -68
  50. data/spec/integration/bson_symbol_spec.rb +0 -39
  51. data/spec/integration/bulk_insert_spec.rb +0 -83
  52. data/spec/integration/bulk_write_error_message_spec.rb +0 -74
  53. data/spec/integration/bulk_write_spec.rb +0 -86
  54. data/spec/integration/change_stream_examples_spec.rb +0 -208
  55. data/spec/integration/change_stream_spec.rb +0 -814
  56. data/spec/integration/check_clean_slate_spec.rb +0 -19
  57. data/spec/integration/client_authentication_options_spec.rb +0 -514
  58. data/spec/integration/client_connectivity_spec.rb +0 -41
  59. data/spec/integration/client_construction_aws_auth_spec.rb +0 -203
  60. data/spec/integration/client_construction_spec.rb +0 -381
  61. data/spec/integration/client_side_encryption/auto_encryption_bulk_writes_spec.rb +0 -360
  62. data/spec/integration/client_side_encryption/auto_encryption_command_monitoring_spec.rb +0 -306
  63. data/spec/integration/client_side_encryption/auto_encryption_mongocryptd_spawn_spec.rb +0 -75
  64. data/spec/integration/client_side_encryption/auto_encryption_old_wire_version_spec.rb +0 -82
  65. data/spec/integration/client_side_encryption/auto_encryption_reconnect_spec.rb +0 -260
  66. data/spec/integration/client_side_encryption/auto_encryption_spec.rb +0 -754
  67. data/spec/integration/client_side_encryption/automatic_data_encryption_keys_prose_spec.rb +0 -153
  68. data/spec/integration/client_side_encryption/bson_size_limit_spec.rb +0 -190
  69. data/spec/integration/client_side_encryption/bypass_mongocryptd_spawn_spec.rb +0 -81
  70. data/spec/integration/client_side_encryption/client_close_spec.rb +0 -66
  71. data/spec/integration/client_side_encryption/corpus_spec.rb +0 -273
  72. data/spec/integration/client_side_encryption/custom_endpoint_spec.rb +0 -132
  73. data/spec/integration/client_side_encryption/data_key_spec.rb +0 -258
  74. data/spec/integration/client_side_encryption/decryption_events_prose_spec.rb +0 -159
  75. data/spec/integration/client_side_encryption/explicit_encryption_spec.rb +0 -176
  76. data/spec/integration/client_side_encryption/explicit_queryable_encryption_spec.rb +0 -150
  77. data/spec/integration/client_side_encryption/external_key_vault_spec.rb +0 -144
  78. data/spec/integration/client_side_encryption/kms_tls_options_spec.rb +0 -436
  79. data/spec/integration/client_side_encryption/kms_tls_spec.rb +0 -92
  80. data/spec/integration/client_side_encryption/mongocryptd_prose_spec.rb +0 -105
  81. data/spec/integration/client_side_encryption/on_demand_aws_credentials_spec.rb +0 -49
  82. data/spec/integration/client_side_encryption/on_demand_azure_credentials_spec.rb +0 -46
  83. data/spec/integration/client_side_encryption/on_demand_gcp_credentials_spec.rb +0 -47
  84. data/spec/integration/client_side_encryption/queryable_encryption_examples_spec.rb +0 -114
  85. data/spec/integration/client_side_encryption/range_explicit_encryption_prose_spec.rb +0 -583
  86. data/spec/integration/client_side_encryption/rewrap_prose_spec.rb +0 -114
  87. data/spec/integration/client_side_encryption/unique_index_on_key_alt_names_prose_spec.rb +0 -89
  88. data/spec/integration/client_side_encryption/views_spec.rb +0 -47
  89. data/spec/integration/client_side_operations_timeout/encryption_prose_spec.rb +0 -131
  90. data/spec/integration/client_spec.rb +0 -54
  91. data/spec/integration/client_update_spec.rb +0 -161
  92. data/spec/integration/collection_indexes_prose_spec.rb +0 -58
  93. data/spec/integration/command_monitoring_spec.rb +0 -184
  94. data/spec/integration/command_spec.rb +0 -157
  95. data/spec/integration/connect_single_rs_name_spec.rb +0 -75
  96. data/spec/integration/connection/faas_env_spec.rb +0 -62
  97. data/spec/integration/connection_pool_populator_spec.rb +0 -327
  98. data/spec/integration/connection_spec.rb +0 -353
  99. data/spec/integration/crud_spec.rb +0 -378
  100. data/spec/integration/cursor_pinning_spec.rb +0 -80
  101. data/spec/integration/cursor_reaping_spec.rb +0 -143
  102. data/spec/integration/docs_examples_spec.rb +0 -207
  103. data/spec/integration/error_detection_spec.rb +0 -42
  104. data/spec/integration/find_options_spec.rb +0 -227
  105. data/spec/integration/fork_reconnect_spec.rb +0 -207
  106. data/spec/integration/get_more_spec.rb +0 -42
  107. data/spec/integration/grid_fs_bucket_spec.rb +0 -51
  108. data/spec/integration/heartbeat_events_spec.rb +0 -102
  109. data/spec/integration/map_reduce_spec.rb +0 -81
  110. data/spec/integration/mmapv1_spec.rb +0 -31
  111. data/spec/integration/mongos_pinning_spec.rb +0 -37
  112. data/spec/integration/ocsp_connectivity_spec.rb +0 -29
  113. data/spec/integration/ocsp_verifier_cache_spec.rb +0 -191
  114. data/spec/integration/ocsp_verifier_spec.rb +0 -358
  115. data/spec/integration/operation_failure_code_spec.rb +0 -29
  116. data/spec/integration/operation_failure_message_spec.rb +0 -91
  117. data/spec/integration/query_cache_spec.rb +0 -1343
  118. data/spec/integration/query_cache_transactions_spec.rb +0 -193
  119. data/spec/integration/read_concern_spec.rb +0 -92
  120. data/spec/integration/read_preference_spec.rb +0 -548
  121. data/spec/integration/reconnect_spec.rb +0 -200
  122. data/spec/integration/retryable_errors_spec.rb +0 -286
  123. data/spec/integration/retryable_reads_errors_spec.rb +0 -275
  124. data/spec/integration/retryable_writes/retryable_writes_36_and_older_spec.rb +0 -764
  125. data/spec/integration/retryable_writes/retryable_writes_40_and_newer_spec.rb +0 -405
  126. data/spec/integration/retryable_writes/shared/adds_diagnostics.rb +0 -18
  127. data/spec/integration/retryable_writes/shared/does_not_support_retries.rb +0 -27
  128. data/spec/integration/retryable_writes/shared/only_supports_legacy_retries.rb +0 -28
  129. data/spec/integration/retryable_writes/shared/performs_legacy_retries.rb +0 -220
  130. data/spec/integration/retryable_writes/shared/performs_modern_retries.rb +0 -235
  131. data/spec/integration/retryable_writes/shared/performs_no_retries.rb +0 -113
  132. data/spec/integration/retryable_writes/shared/supports_legacy_retries.rb +0 -22
  133. data/spec/integration/retryable_writes/shared/supports_modern_retries.rb +0 -28
  134. data/spec/integration/retryable_writes/shared/supports_retries.rb +0 -19
  135. data/spec/integration/retryable_writes_errors_spec.rb +0 -348
  136. data/spec/integration/sdam_error_handling_spec.rb +0 -490
  137. data/spec/integration/sdam_events_spec.rb +0 -178
  138. data/spec/integration/sdam_prose_spec.rb +0 -67
  139. data/spec/integration/search_indexes_prose_spec.rb +0 -172
  140. data/spec/integration/secondary_reads_spec.rb +0 -103
  141. data/spec/integration/server_description_spec.rb +0 -48
  142. data/spec/integration/server_monitor_spec.rb +0 -57
  143. data/spec/integration/server_selection_spec.rb +0 -39
  144. data/spec/integration/server_selector_spec.rb +0 -107
  145. data/spec/integration/server_spec.rb +0 -67
  146. data/spec/integration/shell_examples_spec.rb +0 -984
  147. data/spec/integration/size_limit_spec.rb +0 -118
  148. data/spec/integration/snappy_compression_spec.rb +0 -28
  149. data/spec/integration/snapshot_query_examples_spec.rb +0 -129
  150. data/spec/integration/srv_monitoring_spec.rb +0 -445
  151. data/spec/integration/srv_spec.rb +0 -60
  152. data/spec/integration/ssl_uri_options_spec.rb +0 -28
  153. data/spec/integration/step_down_spec.rb +0 -225
  154. data/spec/integration/time_zone_querying_spec.rb +0 -55
  155. data/spec/integration/transaction_pinning_spec.rb +0 -134
  156. data/spec/integration/transactions_api_examples_spec.rb +0 -64
  157. data/spec/integration/transactions_examples_spec.rb +0 -235
  158. data/spec/integration/truncated_utf8_spec.rb +0 -26
  159. data/spec/integration/versioned_api_examples_spec.rb +0 -120
  160. data/spec/integration/x509_auth_spec.rb +0 -112
  161. data/spec/integration/zlib_compression_spec.rb +0 -28
  162. data/spec/integration/zstd_compression_spec.rb +0 -29
  163. data/spec/kerberos/kerberos_spec.rb +0 -98
  164. data/spec/lite_spec_helper.rb +0 -211
  165. data/spec/mongo/address/ipv4_spec.rb +0 -102
  166. data/spec/mongo/address/ipv6_spec.rb +0 -137
  167. data/spec/mongo/address/unix_spec.rb +0 -45
  168. data/spec/mongo/address/validator_spec.rb +0 -54
  169. data/spec/mongo/address_spec.rb +0 -357
  170. data/spec/mongo/auth/aws/credential_cache_spec.rb +0 -63
  171. data/spec/mongo/auth/aws/credentials_retriever_spec.rb +0 -90
  172. data/spec/mongo/auth/aws/credentials_spec.rb +0 -46
  173. data/spec/mongo/auth/aws/request_region_spec.rb +0 -45
  174. data/spec/mongo/auth/aws/request_spec.rb +0 -79
  175. data/spec/mongo/auth/cr_spec.rb +0 -58
  176. data/spec/mongo/auth/gssapi/conversation_spec.rb +0 -124
  177. data/spec/mongo/auth/invalid_mechanism_spec.rb +0 -14
  178. data/spec/mongo/auth/ldap/conversation_spec.rb +0 -46
  179. data/spec/mongo/auth/ldap_spec.rb +0 -46
  180. data/spec/mongo/auth/scram/conversation_spec.rb +0 -205
  181. data/spec/mongo/auth/scram256/conversation_spec.rb +0 -174
  182. data/spec/mongo/auth/scram_negotiation_spec.rb +0 -532
  183. data/spec/mongo/auth/scram_spec.rb +0 -121
  184. data/spec/mongo/auth/stringprep/profiles/sasl_spec.rb +0 -116
  185. data/spec/mongo/auth/stringprep_spec.rb +0 -191
  186. data/spec/mongo/auth/user/view_spec.rb +0 -584
  187. data/spec/mongo/auth/user_spec.rb +0 -343
  188. data/spec/mongo/auth/x509/conversation_spec.rb +0 -72
  189. data/spec/mongo/auth/x509_spec.rb +0 -72
  190. data/spec/mongo/auth_spec.rb +0 -68
  191. data/spec/mongo/bson_spec.rb +0 -14
  192. data/spec/mongo/bulk_write/ordered_combiner_spec.rb +0 -287
  193. data/spec/mongo/bulk_write/result_spec.rb +0 -141
  194. data/spec/mongo/bulk_write/unordered_combiner_spec.rb +0 -242
  195. data/spec/mongo/bulk_write_spec.rb +0 -2514
  196. data/spec/mongo/caching_cursor_spec.rb +0 -73
  197. data/spec/mongo/client_construction_spec.rb +0 -2723
  198. data/spec/mongo/client_encryption_spec.rb +0 -403
  199. data/spec/mongo/client_spec.rb +0 -1357
  200. data/spec/mongo/cluster/cursor_reaper_spec.rb +0 -230
  201. data/spec/mongo/cluster/periodic_executor_spec.rb +0 -21
  202. data/spec/mongo/cluster/socket_reaper_spec.rb +0 -46
  203. data/spec/mongo/cluster/topology/replica_set_spec.rb +0 -601
  204. data/spec/mongo/cluster/topology/sharded_spec.rb +0 -158
  205. data/spec/mongo/cluster/topology/single_spec.rb +0 -192
  206. data/spec/mongo/cluster/topology/unknown_spec.rb +0 -103
  207. data/spec/mongo/cluster/topology_spec.rb +0 -211
  208. data/spec/mongo/cluster_spec.rb +0 -825
  209. data/spec/mongo/cluster_time_spec.rb +0 -151
  210. data/spec/mongo/collection/view/aggregation_spec.rb +0 -753
  211. data/spec/mongo/collection/view/builder/find_command_spec.rb +0 -528
  212. data/spec/mongo/collection/view/builder/op_query_spec.rb +0 -161
  213. data/spec/mongo/collection/view/change_stream_resume_spec.rb +0 -397
  214. data/spec/mongo/collection/view/change_stream_spec.rb +0 -547
  215. data/spec/mongo/collection/view/explainable_spec.rb +0 -119
  216. data/spec/mongo/collection/view/immutable_spec.rb +0 -57
  217. data/spec/mongo/collection/view/iterable_spec.rb +0 -41
  218. data/spec/mongo/collection/view/map_reduce_spec.rb +0 -907
  219. data/spec/mongo/collection/view/readable_spec.rb +0 -2283
  220. data/spec/mongo/collection/view/writable_spec.rb +0 -1976
  221. data/spec/mongo/collection/view_spec.rb +0 -424
  222. data/spec/mongo/collection_crud_spec.rb +0 -4472
  223. data/spec/mongo/collection_ddl_spec.rb +0 -587
  224. data/spec/mongo/collection_spec.rb +0 -849
  225. data/spec/mongo/condition_variable_spec.rb +0 -104
  226. data/spec/mongo/config/options_spec.rb +0 -76
  227. data/spec/mongo/config_spec.rb +0 -74
  228. data/spec/mongo/crypt/auto_decryption_context_spec.rb +0 -109
  229. data/spec/mongo/crypt/auto_encrypter_spec.rb +0 -450
  230. data/spec/mongo/crypt/auto_encryption_context_spec.rb +0 -126
  231. data/spec/mongo/crypt/binary_spec.rb +0 -113
  232. data/spec/mongo/crypt/binding/binary_spec.rb +0 -54
  233. data/spec/mongo/crypt/binding/context_spec.rb +0 -305
  234. data/spec/mongo/crypt/binding/helpers_spec.rb +0 -44
  235. data/spec/mongo/crypt/binding/mongocrypt_spec.rb +0 -113
  236. data/spec/mongo/crypt/binding/status_spec.rb +0 -97
  237. data/spec/mongo/crypt/binding/version_spec.rb +0 -67
  238. data/spec/mongo/crypt/binding_unloaded_spec.rb +0 -37
  239. data/spec/mongo/crypt/data_key_context_spec.rb +0 -146
  240. data/spec/mongo/crypt/encryption_io_spec.rb +0 -141
  241. data/spec/mongo/crypt/explicit_decryption_context_spec.rb +0 -106
  242. data/spec/mongo/crypt/explicit_encryption_context_spec.rb +0 -266
  243. data/spec/mongo/crypt/handle_spec.rb +0 -266
  244. data/spec/mongo/crypt/helpers/mongo_crypt_spec_helper.rb +0 -111
  245. data/spec/mongo/crypt/hooks_spec.rb +0 -30
  246. data/spec/mongo/crypt/kms/azure/credentials_retriever_spec.rb +0 -86
  247. data/spec/mongo/crypt/kms/credentials_spec.rb +0 -373
  248. data/spec/mongo/crypt/kms_spec.rb +0 -62
  249. data/spec/mongo/crypt/status_spec.rb +0 -150
  250. data/spec/mongo/crypt_spec.rb +0 -21
  251. data/spec/mongo/cursor/builder/get_more_command_spec.rb +0 -195
  252. data/spec/mongo/cursor/builder/op_get_more_spec.rb +0 -68
  253. data/spec/mongo/cursor_spec.rb +0 -851
  254. data/spec/mongo/database_spec.rb +0 -1365
  255. data/spec/mongo/distinguishing_semaphore_spec.rb +0 -66
  256. data/spec/mongo/error/bulk_write_error_spec.rb +0 -52
  257. data/spec/mongo/error/crypt_error_spec.rb +0 -29
  258. data/spec/mongo/error/max_bson_size_spec.rb +0 -38
  259. data/spec/mongo/error/no_server_available_spec.rb +0 -35
  260. data/spec/mongo/error/notable_spec.rb +0 -62
  261. data/spec/mongo/error/operation_failure_heavy_spec.rb +0 -110
  262. data/spec/mongo/error/operation_failure_spec.rb +0 -553
  263. data/spec/mongo/error/parser_spec.rb +0 -519
  264. data/spec/mongo/error/unsupported_option_spec.rb +0 -57
  265. data/spec/mongo/event/publisher_spec.rb +0 -53
  266. data/spec/mongo/event/subscriber_spec.rb +0 -37
  267. data/spec/mongo/grid/file/chunk_spec.rb +0 -230
  268. data/spec/mongo/grid/file/info_spec.rb +0 -107
  269. data/spec/mongo/grid/file_spec.rb +0 -194
  270. data/spec/mongo/grid/fs_bucket_spec.rb +0 -1269
  271. data/spec/mongo/grid/stream/read_spec.rb +0 -292
  272. data/spec/mongo/grid/stream/write_spec.rb +0 -559
  273. data/spec/mongo/grid/stream_spec.rb +0 -51
  274. data/spec/mongo/id_spec.rb +0 -38
  275. data/spec/mongo/index/view_spec.rb +0 -1296
  276. data/spec/mongo/lint_spec.rb +0 -231
  277. data/spec/mongo/logger_spec.rb +0 -62
  278. data/spec/mongo/monitoring/command_log_subscriber_spec.rb +0 -79
  279. data/spec/mongo/monitoring/event/cmap/connection_check_out_failed_spec.rb +0 -26
  280. data/spec/mongo/monitoring/event/cmap/connection_check_out_started_spec.rb +0 -22
  281. data/spec/mongo/monitoring/event/cmap/connection_checked_in_spec.rb +0 -33
  282. data/spec/mongo/monitoring/event/cmap/connection_checked_out_spec.rb +0 -33
  283. data/spec/mongo/monitoring/event/cmap/connection_closed_spec.rb +0 -30
  284. data/spec/mongo/monitoring/event/cmap/connection_created_spec.rb +0 -27
  285. data/spec/mongo/monitoring/event/cmap/connection_ready_spec.rb +0 -27
  286. data/spec/mongo/monitoring/event/cmap/pool_cleared_spec.rb +0 -22
  287. data/spec/mongo/monitoring/event/cmap/pool_closed_spec.rb +0 -29
  288. data/spec/mongo/monitoring/event/cmap/pool_created_spec.rb +0 -36
  289. data/spec/mongo/monitoring/event/command_failed_spec.rb +0 -87
  290. data/spec/mongo/monitoring/event/command_started_spec.rb +0 -51
  291. data/spec/mongo/monitoring/event/command_succeeded_spec.rb +0 -88
  292. data/spec/mongo/monitoring/event/secure_spec.rb +0 -123
  293. data/spec/mongo/monitoring/event/server_closed_spec.rb +0 -38
  294. data/spec/mongo/monitoring/event/server_description_changed_spec.rb +0 -38
  295. data/spec/mongo/monitoring/event/server_heartbeat_failed_spec.rb +0 -34
  296. data/spec/mongo/monitoring/event/server_heartbeat_started_spec.rb +0 -34
  297. data/spec/mongo/monitoring/event/server_heartbeat_succeeded_spec.rb +0 -34
  298. data/spec/mongo/monitoring/event/server_opening_spec.rb +0 -38
  299. data/spec/mongo/monitoring/event/topology_changed_spec.rb +0 -44
  300. data/spec/mongo/monitoring/event/topology_closed_spec.rb +0 -38
  301. data/spec/mongo/monitoring/event/topology_opening_spec.rb +0 -38
  302. data/spec/mongo/monitoring_spec.rb +0 -196
  303. data/spec/mongo/operation/aggregate/result_spec.rb +0 -90
  304. data/spec/mongo/operation/aggregate_spec.rb +0 -76
  305. data/spec/mongo/operation/collections_info_spec.rb +0 -48
  306. data/spec/mongo/operation/command_spec.rb +0 -86
  307. data/spec/mongo/operation/context_spec.rb +0 -79
  308. data/spec/mongo/operation/create/op_msg_spec.rb +0 -240
  309. data/spec/mongo/operation/create_index_spec.rb +0 -62
  310. data/spec/mongo/operation/create_user_spec.rb +0 -53
  311. data/spec/mongo/operation/delete/bulk_spec.rb +0 -245
  312. data/spec/mongo/operation/delete/op_msg_spec.rb +0 -267
  313. data/spec/mongo/operation/delete_spec.rb +0 -203
  314. data/spec/mongo/operation/drop_index_spec.rb +0 -61
  315. data/spec/mongo/operation/find/builder/flags_spec.rb +0 -109
  316. data/spec/mongo/operation/find/builder/modifiers_spec.rb +0 -213
  317. data/spec/mongo/operation/find/op_msg_spec.rb +0 -66
  318. data/spec/mongo/operation/get_more/op_msg_spec.rb +0 -65
  319. data/spec/mongo/operation/indexes_spec.rb +0 -41
  320. data/spec/mongo/operation/insert/bulk_spec.rb +0 -273
  321. data/spec/mongo/operation/insert/op_msg_spec.rb +0 -293
  322. data/spec/mongo/operation/insert_spec.rb +0 -258
  323. data/spec/mongo/operation/limited_spec.rb +0 -55
  324. data/spec/mongo/operation/map_reduce_spec.rb +0 -131
  325. data/spec/mongo/operation/read_preference_legacy_spec.rb +0 -360
  326. data/spec/mongo/operation/read_preference_op_msg_spec.rb +0 -332
  327. data/spec/mongo/operation/remove_user_spec.rb +0 -52
  328. data/spec/mongo/operation/result_spec.rb +0 -369
  329. data/spec/mongo/operation/shared/csot/examples.rb +0 -113
  330. data/spec/mongo/operation/specifiable_spec.rb +0 -87
  331. data/spec/mongo/operation/update/bulk_spec.rb +0 -239
  332. data/spec/mongo/operation/update/op_msg_spec.rb +0 -272
  333. data/spec/mongo/operation/update_spec.rb +0 -235
  334. data/spec/mongo/operation/update_user_spec.rb +0 -52
  335. data/spec/mongo/options/redacted_spec.rb +0 -353
  336. data/spec/mongo/protocol/caching_hash_spec.rb +0 -37
  337. data/spec/mongo/protocol/compressed_spec.rb +0 -83
  338. data/spec/mongo/protocol/get_more_spec.rb +0 -164
  339. data/spec/mongo/protocol/kill_cursors_spec.rb +0 -121
  340. data/spec/mongo/protocol/msg_spec.rb +0 -507
  341. data/spec/mongo/protocol/query_spec.rb +0 -347
  342. data/spec/mongo/protocol/registry_spec.rb +0 -34
  343. data/spec/mongo/protocol/reply_spec.rb +0 -198
  344. data/spec/mongo/query_cache_middleware_spec.rb +0 -55
  345. data/spec/mongo/query_cache_spec.rb +0 -471
  346. data/spec/mongo/retryable/write_worker_spec.rb +0 -39
  347. data/spec/mongo/retryable_spec.rb +0 -624
  348. data/spec/mongo/semaphore_spec.rb +0 -54
  349. data/spec/mongo/server/app_metadata/environment_spec.rb +0 -344
  350. data/spec/mongo/server/app_metadata/truncator_spec.rb +0 -158
  351. data/spec/mongo/server/app_metadata_spec.rb +0 -158
  352. data/spec/mongo/server/connection_auth_spec.rb +0 -138
  353. data/spec/mongo/server/connection_common_spec.rb +0 -87
  354. data/spec/mongo/server/connection_pool/populator_spec.rb +0 -120
  355. data/spec/mongo/server/connection_pool_spec.rb +0 -1609
  356. data/spec/mongo/server/connection_spec.rb +0 -1310
  357. data/spec/mongo/server/description/features_spec.rb +0 -274
  358. data/spec/mongo/server/description_query_methods_spec.rb +0 -291
  359. data/spec/mongo/server/description_spec.rb +0 -846
  360. data/spec/mongo/server/monitor/app_metadata_spec.rb +0 -25
  361. data/spec/mongo/server/monitor/connection_spec.rb +0 -197
  362. data/spec/mongo/server/monitor_spec.rb +0 -326
  363. data/spec/mongo/server/push_monitor_spec.rb +0 -95
  364. data/spec/mongo/server/round_trip_time_calculator_spec.rb +0 -120
  365. data/spec/mongo/server_selector/nearest_spec.rb +0 -338
  366. data/spec/mongo/server_selector/primary_preferred_spec.rb +0 -372
  367. data/spec/mongo/server_selector/primary_spec.rb +0 -181
  368. data/spec/mongo/server_selector/secondary_preferred_spec.rb +0 -350
  369. data/spec/mongo/server_selector/secondary_spec.rb +0 -278
  370. data/spec/mongo/server_selector_spec.rb +0 -736
  371. data/spec/mongo/server_spec.rb +0 -463
  372. data/spec/mongo/session/server_session_spec.rb +0 -62
  373. data/spec/mongo/session/session_pool_spec.rb +0 -257
  374. data/spec/mongo/session_spec.rb +0 -368
  375. data/spec/mongo/session_transaction_spec.rb +0 -222
  376. data/spec/mongo/socket/ssl_spec.rb +0 -830
  377. data/spec/mongo/socket/tcp_spec.rb +0 -17
  378. data/spec/mongo/socket/unix_spec.rb +0 -56
  379. data/spec/mongo/socket_spec.rb +0 -119
  380. data/spec/mongo/srv/monitor_spec.rb +0 -233
  381. data/spec/mongo/srv/result_spec.rb +0 -57
  382. data/spec/mongo/timeout_spec.rb +0 -42
  383. data/spec/mongo/tls_context_hooks_spec.rb +0 -40
  384. data/spec/mongo/uri/options_mapper_spec.rb +0 -1605
  385. data/spec/mongo/uri/srv_protocol_spec.rb +0 -1367
  386. data/spec/mongo/uri_option_parsing_spec.rb +0 -625
  387. data/spec/mongo/uri_spec.rb +0 -1443
  388. data/spec/mongo/utils_spec.rb +0 -42
  389. data/spec/mongo/write_concern/acknowledged_spec.rb +0 -58
  390. data/spec/mongo/write_concern/unacknowledged_spec.rb +0 -29
  391. data/spec/mongo/write_concern_spec.rb +0 -227
  392. data/spec/runners/auth.rb +0 -140
  393. data/spec/runners/change_streams/outcome.rb +0 -45
  394. data/spec/runners/change_streams/spec.rb +0 -60
  395. data/spec/runners/change_streams/test.rb +0 -232
  396. data/spec/runners/cmap/verifier.rb +0 -48
  397. data/spec/runners/cmap.rb +0 -516
  398. data/spec/runners/command_monitoring.rb +0 -346
  399. data/spec/runners/connection_string.rb +0 -393
  400. data/spec/runners/crud/context.rb +0 -30
  401. data/spec/runners/crud/operation.rb +0 -480
  402. data/spec/runners/crud/outcome.rb +0 -56
  403. data/spec/runners/crud/requirement.rb +0 -139
  404. data/spec/runners/crud/spec.rb +0 -76
  405. data/spec/runners/crud/test.rb +0 -115
  406. data/spec/runners/crud/test_base.rb +0 -53
  407. data/spec/runners/crud/verifier.rb +0 -224
  408. data/spec/runners/crud.rb +0 -257
  409. data/spec/runners/gridfs.rb +0 -641
  410. data/spec/runners/read_write_concern_document.rb +0 -70
  411. data/spec/runners/sdam/verifier.rb +0 -112
  412. data/spec/runners/sdam.rb +0 -279
  413. data/spec/runners/server_selection.rb +0 -365
  414. data/spec/runners/server_selection_rtt.rb +0 -41
  415. data/spec/runners/transactions/operation.rb +0 -332
  416. data/spec/runners/transactions/spec.rb +0 -29
  417. data/spec/runners/transactions/test.rb +0 -379
  418. data/spec/runners/transactions.rb +0 -107
  419. data/spec/runners/unified/ambiguous_operations.rb +0 -13
  420. data/spec/runners/unified/assertions.rb +0 -396
  421. data/spec/runners/unified/change_stream_operations.rb +0 -42
  422. data/spec/runners/unified/client_side_encryption_operations.rb +0 -83
  423. data/spec/runners/unified/crud_operations.rb +0 -367
  424. data/spec/runners/unified/ddl_operations.rb +0 -286
  425. data/spec/runners/unified/entity_map.rb +0 -42
  426. data/spec/runners/unified/error.rb +0 -29
  427. data/spec/runners/unified/event_subscriber.rb +0 -110
  428. data/spec/runners/unified/exceptions.rb +0 -24
  429. data/spec/runners/unified/grid_fs_operations.rb +0 -114
  430. data/spec/runners/unified/search_index_operations.rb +0 -63
  431. data/spec/runners/unified/support_operations.rb +0 -370
  432. data/spec/runners/unified/test.rb +0 -606
  433. data/spec/runners/unified/test_group.rb +0 -31
  434. data/spec/runners/unified/thread_operations.rb +0 -73
  435. data/spec/runners/unified.rb +0 -109
  436. data/spec/solo/clean_exit_spec.rb +0 -24
  437. data/spec/spec_helper.rb +0 -35
  438. data/spec/spec_tests/auth_spec.rb +0 -58
  439. data/spec/spec_tests/change_streams_unified_spec.rb +0 -14
  440. data/spec/spec_tests/client_side_encryption_spec.rb +0 -37
  441. data/spec/spec_tests/client_side_encryption_unified_spec.rb +0 -26
  442. data/spec/spec_tests/client_side_operations_timeout_spec.rb +0 -15
  443. data/spec/spec_tests/cmap_spec.rb +0 -126
  444. data/spec/spec_tests/collection_management_spec.rb +0 -13
  445. data/spec/spec_tests/command_monitoring_unified_spec.rb +0 -13
  446. data/spec/spec_tests/connection_string_spec.rb +0 -10
  447. data/spec/spec_tests/crud_spec.rb +0 -12
  448. data/spec/spec_tests/crud_unified_spec.rb +0 -13
  449. data/spec/spec_tests/data/auth/connection-string.yml +0 -366
  450. data/spec/spec_tests/data/change_streams_unified/change-streams-clusterTime.yml +0 -43
  451. data/spec/spec_tests/data/change_streams_unified/change-streams-disambiguatedPaths.yml +0 -105
  452. data/spec/spec_tests/data/change_streams_unified/change-streams-errors.yml +0 -122
  453. data/spec/spec_tests/data/change_streams_unified/change-streams-pre_and_post_images.yml +0 -351
  454. data/spec/spec_tests/data/change_streams_unified/change-streams-resume-allowlist.yml +0 -1169
  455. data/spec/spec_tests/data/change_streams_unified/change-streams-resume-errorLabels.yml +0 -1069
  456. data/spec/spec_tests/data/change_streams_unified/change-streams-showExpandedEvents.yml +0 -307
  457. data/spec/spec_tests/data/change_streams_unified/change-streams.yml +0 -927
  458. data/spec/spec_tests/data/client_side_encryption/aggregate.yml +0 -120
  459. data/spec/spec_tests/data/client_side_encryption/awsTemporary.yml +0 -57
  460. data/spec/spec_tests/data/client_side_encryption/azureKMS.yml +0 -46
  461. data/spec/spec_tests/data/client_side_encryption/badQueries.yml +0 -537
  462. data/spec/spec_tests/data/client_side_encryption/badSchema.yml +0 -73
  463. data/spec/spec_tests/data/client_side_encryption/basic.yml +0 -102
  464. data/spec/spec_tests/data/client_side_encryption/bulk.yml +0 -81
  465. data/spec/spec_tests/data/client_side_encryption/bypassAutoEncryption.yml +0 -100
  466. data/spec/spec_tests/data/client_side_encryption/bypassedCommand.yml +0 -43
  467. data/spec/spec_tests/data/client_side_encryption/count.yml +0 -54
  468. data/spec/spec_tests/data/client_side_encryption/countDocuments.yml +0 -52
  469. data/spec/spec_tests/data/client_side_encryption/create-and-createIndexes.yml +0 -58
  470. data/spec/spec_tests/data/client_side_encryption/delete.yml +0 -91
  471. data/spec/spec_tests/data/client_side_encryption/distinct.yml +0 -66
  472. data/spec/spec_tests/data/client_side_encryption/explain.yml +0 -57
  473. data/spec/spec_tests/data/client_side_encryption/find.yml +0 -105
  474. data/spec/spec_tests/data/client_side_encryption/findOneAndDelete.yml +0 -50
  475. data/spec/spec_tests/data/client_side_encryption/findOneAndReplace.yml +0 -50
  476. data/spec/spec_tests/data/client_side_encryption/findOneAndUpdate.yml +0 -50
  477. data/spec/spec_tests/data/client_side_encryption/fle2v2-BypassQueryAnalysis.yml +0 -90
  478. data/spec/spec_tests/data/client_side_encryption/fle2v2-Compact.yml +0 -83
  479. data/spec/spec_tests/data/client_side_encryption/fle2v2-CreateCollection-OldServer.yml +0 -61
  480. data/spec/spec_tests/data/client_side_encryption/fle2v2-CreateCollection.yml +0 -938
  481. data/spec/spec_tests/data/client_side_encryption/fle2v2-DecryptExistingData.yml +0 -67
  482. data/spec/spec_tests/data/client_side_encryption/fle2v2-Delete.yml +0 -101
  483. data/spec/spec_tests/data/client_side_encryption/fle2v2-EncryptedFields-vs-EncryptedFieldsMap.yml +0 -80
  484. data/spec/spec_tests/data/client_side_encryption/fle2v2-EncryptedFields-vs-jsonSchema.yml +0 -103
  485. data/spec/spec_tests/data/client_side_encryption/fle2v2-EncryptedFieldsMap-defaults.yml +0 -59
  486. data/spec/spec_tests/data/client_side_encryption/fle2v2-FindOneAndUpdate.yml +0 -201
  487. data/spec/spec_tests/data/client_side_encryption/fle2v2-InsertFind-Indexed.yml +0 -97
  488. data/spec/spec_tests/data/client_side_encryption/fle2v2-InsertFind-Unindexed.yml +0 -90
  489. data/spec/spec_tests/data/client_side_encryption/fle2v2-MissingKey.yml +0 -44
  490. data/spec/spec_tests/data/client_side_encryption/fle2v2-NoEncryption.yml +0 -45
  491. data/spec/spec_tests/data/client_side_encryption/fle2v2-Update.yml +0 -211
  492. data/spec/spec_tests/data/client_side_encryption/fle2v2-validatorAndPartialFieldExpression.yml +0 -170
  493. data/spec/spec_tests/data/client_side_encryption/gcpKMS.yml +0 -46
  494. data/spec/spec_tests/data/client_side_encryption/getMore.yml +0 -61
  495. data/spec/spec_tests/data/client_side_encryption/insert.yml +0 -88
  496. data/spec/spec_tests/data/client_side_encryption/keyAltName.yml +0 -64
  497. data/spec/spec_tests/data/client_side_encryption/localKMS.yml +0 -47
  498. data/spec/spec_tests/data/client_side_encryption/localSchema.yml +0 -65
  499. data/spec/spec_tests/data/client_side_encryption/malformedCiphertext.yml +0 -69
  500. data/spec/spec_tests/data/client_side_encryption/maxWireVersion.yml +0 -22
  501. data/spec/spec_tests/data/client_side_encryption/missingKey.yml +0 -42
  502. data/spec/spec_tests/data/client_side_encryption/noSchema.yml +0 -39
  503. data/spec/spec_tests/data/client_side_encryption/replaceOne.yml +0 -57
  504. data/spec/spec_tests/data/client_side_encryption/timeoutMS.yml +0 -67
  505. data/spec/spec_tests/data/client_side_encryption/types.yml +0 -501
  506. data/spec/spec_tests/data/client_side_encryption/unified/addKeyAltName.yml +0 -194
  507. data/spec/spec_tests/data/client_side_encryption/unified/createDataKey-kms_providers-invalid.yml +0 -67
  508. data/spec/spec_tests/data/client_side_encryption/unified/createDataKey.yml +0 -309
  509. data/spec/spec_tests/data/client_side_encryption/unified/deleteKey.yml +0 -159
  510. data/spec/spec_tests/data/client_side_encryption/unified/getKey.yml +0 -105
  511. data/spec/spec_tests/data/client_side_encryption/unified/getKeyByAltName.yml +0 -104
  512. data/spec/spec_tests/data/client_side_encryption/unified/getKeys.yml +0 -122
  513. data/spec/spec_tests/data/client_side_encryption/unified/removeKeyAltName.yml +0 -157
  514. data/spec/spec_tests/data/client_side_encryption/unified/rewrapManyDataKey-decrypt_failure.yml +0 -69
  515. data/spec/spec_tests/data/client_side_encryption/unified/rewrapManyDataKey-encrypt_failure.yml +0 -122
  516. data/spec/spec_tests/data/client_side_encryption/unified/rewrapManyDataKey.yml +0 -432
  517. data/spec/spec_tests/data/client_side_encryption/unsupportedCommand.yml +0 -25
  518. data/spec/spec_tests/data/client_side_encryption/updateMany.yml +0 -70
  519. data/spec/spec_tests/data/client_side_encryption/updateOne.yml +0 -164
  520. data/spec/spec_tests/data/client_side_encryption/validatorAndPartialFieldExpression.yml +0 -166
  521. data/spec/spec_tests/data/client_side_operations_timeout/bulkWrite.yml +0 -87
  522. data/spec/spec_tests/data/client_side_operations_timeout/change-streams.yml +0 -358
  523. data/spec/spec_tests/data/client_side_operations_timeout/close-cursors.yml +0 -129
  524. data/spec/spec_tests/data/client_side_operations_timeout/command-execution.yml +0 -250
  525. data/spec/spec_tests/data/client_side_operations_timeout/convenient-transactions.yml +0 -113
  526. data/spec/spec_tests/data/client_side_operations_timeout/cursors.yml +0 -70
  527. data/spec/spec_tests/data/client_side_operations_timeout/deprecated-options.yml +0 -3982
  528. data/spec/spec_tests/data/client_side_operations_timeout/error-transformations.yml +0 -96
  529. data/spec/spec_tests/data/client_side_operations_timeout/global-timeoutMS.yml +0 -3236
  530. data/spec/spec_tests/data/client_side_operations_timeout/gridfs-advanced.yml +0 -207
  531. data/spec/spec_tests/data/client_side_operations_timeout/gridfs-delete.yml +0 -152
  532. data/spec/spec_tests/data/client_side_operations_timeout/gridfs-download.yml +0 -182
  533. data/spec/spec_tests/data/client_side_operations_timeout/gridfs-find.yml +0 -100
  534. data/spec/spec_tests/data/client_side_operations_timeout/gridfs-upload.yml +0 -249
  535. data/spec/spec_tests/data/client_side_operations_timeout/legacy-timeouts.yml +0 -204
  536. data/spec/spec_tests/data/client_side_operations_timeout/non-tailable-cursors.yml +0 -307
  537. data/spec/spec_tests/data/client_side_operations_timeout/override-collection-timeoutMS.yml +0 -1877
  538. data/spec/spec_tests/data/client_side_operations_timeout/override-operation-timeoutMS.yml +0 -1918
  539. data/spec/spec_tests/data/client_side_operations_timeout/retryability-legacy-timeouts.yml +0 -1676
  540. data/spec/spec_tests/data/client_side_operations_timeout/retryability-timeoutMS.yml +0 -2824
  541. data/spec/spec_tests/data/client_side_operations_timeout/sessions-inherit-timeoutMS.yml +0 -168
  542. data/spec/spec_tests/data/client_side_operations_timeout/sessions-override-operation-timeoutMS.yml +0 -171
  543. data/spec/spec_tests/data/client_side_operations_timeout/sessions-override-timeoutMS.yml +0 -168
  544. data/spec/spec_tests/data/client_side_operations_timeout/tailable-awaitData.yml +0 -247
  545. data/spec/spec_tests/data/client_side_operations_timeout/tailable-non-awaitData.yml +0 -181
  546. data/spec/spec_tests/data/cmap/connection-must-have-id.yml +0 -29
  547. data/spec/spec_tests/data/cmap/connection-must-order-ids.yml +0 -29
  548. data/spec/spec_tests/data/cmap/pool-checkin-destroy-closed.yml +0 -29
  549. data/spec/spec_tests/data/cmap/pool-checkin-destroy-stale.yml +0 -29
  550. data/spec/spec_tests/data/cmap/pool-checkin-make-available.yml +0 -26
  551. data/spec/spec_tests/data/cmap/pool-checkin.yml +0 -24
  552. data/spec/spec_tests/data/cmap/pool-checkout-connection.yml +0 -21
  553. data/spec/spec_tests/data/cmap/pool-checkout-custom-maxConnecting-is-enforced.yml +0 -50
  554. data/spec/spec_tests/data/cmap/pool-checkout-error-closed.yml +0 -38
  555. data/spec/spec_tests/data/cmap/pool-checkout-maxConnecting-is-enforced.yml +0 -81
  556. data/spec/spec_tests/data/cmap/pool-checkout-maxConnecting-timeout.yml +0 -71
  557. data/spec/spec_tests/data/cmap/pool-checkout-minPoolSize-connection-maxConnecting.yml +0 -64
  558. data/spec/spec_tests/data/cmap/pool-checkout-multiple.yml +0 -39
  559. data/spec/spec_tests/data/cmap/pool-checkout-no-idle.yml +0 -41
  560. data/spec/spec_tests/data/cmap/pool-checkout-no-stale.yml +0 -41
  561. data/spec/spec_tests/data/cmap/pool-checkout-returned-connection-maxConnecting.yml +0 -88
  562. data/spec/spec_tests/data/cmap/pool-clear-interrupting-pending-connections.yml +0 -43
  563. data/spec/spec_tests/data/cmap/pool-clear-min-size.yml +0 -41
  564. data/spec/spec_tests/data/cmap/pool-clear-paused.yml +0 -18
  565. data/spec/spec_tests/data/cmap/pool-clear-ready.yml +0 -39
  566. data/spec/spec_tests/data/cmap/pool-clear-schedule-run-interruptInUseConnections-false.yml +0 -48
  567. data/spec/spec_tests/data/cmap/pool-close-destroy-conns.yml +0 -30
  568. data/spec/spec_tests/data/cmap/pool-close.yml +0 -11
  569. data/spec/spec_tests/data/cmap/pool-create-max-size.yml +0 -73
  570. data/spec/spec_tests/data/cmap/pool-create-min-size-error.yml +0 -43
  571. data/spec/spec_tests/data/cmap/pool-create-min-size.yml +0 -43
  572. data/spec/spec_tests/data/cmap/pool-create-with-options.yml +0 -21
  573. data/spec/spec_tests/data/cmap/pool-create.yml +0 -12
  574. data/spec/spec_tests/data/cmap/pool-ready-ready.yml +0 -22
  575. data/spec/spec_tests/data/cmap/pool-ready.yml +0 -30
  576. data/spec/spec_tests/data/cmap/wait-queue-fairness.yml +0 -126
  577. data/spec/spec_tests/data/cmap/wait-queue-timeout.yml +0 -51
  578. data/spec/spec_tests/data/collection_management/clustered-indexes.yml +0 -135
  579. data/spec/spec_tests/data/collection_management/createCollection-pre_and_post_images.yml +0 -50
  580. data/spec/spec_tests/data/collection_management/modifyCollection-errorResponse.yml +0 -59
  581. data/spec/spec_tests/data/collection_management/modifyCollection-pre_and_post_images.yml +0 -58
  582. data/spec/spec_tests/data/collection_management/timeseries-collection.yml +0 -164
  583. data/spec/spec_tests/data/command_monitoring_unified/bulkWrite.yml +0 -68
  584. data/spec/spec_tests/data/command_monitoring_unified/command.yml +0 -50
  585. data/spec/spec_tests/data/command_monitoring_unified/deleteMany.yml +0 -79
  586. data/spec/spec_tests/data/command_monitoring_unified/deleteOne.yml +0 -79
  587. data/spec/spec_tests/data/command_monitoring_unified/find.yml +0 -254
  588. data/spec/spec_tests/data/command_monitoring_unified/insertMany.yml +0 -79
  589. data/spec/spec_tests/data/command_monitoring_unified/insertOne.yml +0 -77
  590. data/spec/spec_tests/data/command_monitoring_unified/pre-42-server-connection-id.yml +0 -56
  591. data/spec/spec_tests/data/command_monitoring_unified/redacted-commands.yml +0 -348
  592. data/spec/spec_tests/data/command_monitoring_unified/server-connection-id.yml +0 -56
  593. data/spec/spec_tests/data/command_monitoring_unified/unacknowledgedBulkWrite.yml +0 -55
  594. data/spec/spec_tests/data/command_monitoring_unified/updateMany.yml +0 -87
  595. data/spec/spec_tests/data/command_monitoring_unified/updateOne.yml +0 -118
  596. data/spec/spec_tests/data/command_monitoring_unified/writeConcernError.yml +0 -80
  597. data/spec/spec_tests/data/connection_string/invalid-uris.yml +0 -251
  598. data/spec/spec_tests/data/connection_string/valid-auth.yml +0 -257
  599. data/spec/spec_tests/data/connection_string/valid-db-with-dotted-name.yml +0 -77
  600. data/spec/spec_tests/data/connection_string/valid-host_identifiers.yml +0 -121
  601. data/spec/spec_tests/data/connection_string/valid-options.yml +0 -30
  602. data/spec/spec_tests/data/connection_string/valid-unix_socket-absolute.yml +0 -197
  603. data/spec/spec_tests/data/connection_string/valid-unix_socket-relative.yml +0 -213
  604. data/spec/spec_tests/data/connection_string/valid-warnings.yml +0 -75
  605. data/spec/spec_tests/data/crud/read/aggregate-collation.yml +0 -18
  606. data/spec/spec_tests/data/crud/read/aggregate-out.yml +0 -44
  607. data/spec/spec_tests/data/crud/read/aggregate.yml +0 -21
  608. data/spec/spec_tests/data/crud/read/count-collation.yml +0 -26
  609. data/spec/spec_tests/data/crud/read/count-empty.yml +0 -29
  610. data/spec/spec_tests/data/crud/read/count.yml +0 -74
  611. data/spec/spec_tests/data/crud/read/distinct-collation.yml +0 -18
  612. data/spec/spec_tests/data/crud/read/distinct.yml +0 -32
  613. data/spec/spec_tests/data/crud/read/find-collation.yml +0 -16
  614. data/spec/spec_tests/data/crud/read/find.yml +0 -49
  615. data/spec/spec_tests/data/crud/write/bulkWrite-arrayFilters.yml +0 -45
  616. data/spec/spec_tests/data/crud/write/bulkWrite-collation.yml +0 -102
  617. data/spec/spec_tests/data/crud/write/bulkWrite.yml +0 -405
  618. data/spec/spec_tests/data/crud/write/deleteMany-collation.yml +0 -23
  619. data/spec/spec_tests/data/crud/write/deleteMany.yml +0 -35
  620. data/spec/spec_tests/data/crud/write/deleteOne-collation.yml +0 -23
  621. data/spec/spec_tests/data/crud/write/deleteOne.yml +0 -48
  622. data/spec/spec_tests/data/crud/write/findOneAndDelete-collation.yml +0 -24
  623. data/spec/spec_tests/data/crud/write/findOneAndDelete.yml +0 -53
  624. data/spec/spec_tests/data/crud/write/findOneAndReplace-collation.yml +0 -25
  625. data/spec/spec_tests/data/crud/write/findOneAndReplace-upsert.yml +0 -91
  626. data/spec/spec_tests/data/crud/write/findOneAndReplace-upsert_pre_2.6.yml +0 -88
  627. data/spec/spec_tests/data/crud/write/findOneAndReplace.yml +0 -113
  628. data/spec/spec_tests/data/crud/write/findOneAndUpdate-arrayFilters.yml +0 -69
  629. data/spec/spec_tests/data/crud/write/findOneAndUpdate-collation.yml +0 -28
  630. data/spec/spec_tests/data/crud/write/findOneAndUpdate.yml +0 -163
  631. data/spec/spec_tests/data/crud/write/insertMany.yml +0 -81
  632. data/spec/spec_tests/data/crud/write/insertOne.yml +0 -18
  633. data/spec/spec_tests/data/crud/write/replaceOne-collation.yml +0 -25
  634. data/spec/spec_tests/data/crud/write/replaceOne-pre_2.6.yml +0 -98
  635. data/spec/spec_tests/data/crud/write/replaceOne-upsert.yml +0 -48
  636. data/spec/spec_tests/data/crud/write/replaceOne.yml +0 -102
  637. data/spec/spec_tests/data/crud/write/updateMany-arrayFilters.yml +0 -66
  638. data/spec/spec_tests/data/crud/write/updateMany-collation.yml +0 -29
  639. data/spec/spec_tests/data/crud/write/updateMany-pre_2.6.yml +0 -86
  640. data/spec/spec_tests/data/crud/write/updateMany.yml +0 -87
  641. data/spec/spec_tests/data/crud/write/updateOne-arrayFilters.yml +0 -114
  642. data/spec/spec_tests/data/crud/write/updateOne-collation.yml +0 -26
  643. data/spec/spec_tests/data/crud/write/updateOne-pre_2.6.yml +0 -83
  644. data/spec/spec_tests/data/crud/write/updateOne.yml +0 -84
  645. data/spec/spec_tests/data/crud_unified/aggregate-allowdiskuse.yml +0 -75
  646. data/spec/spec_tests/data/crud_unified/aggregate-let.yml +0 -138
  647. data/spec/spec_tests/data/crud_unified/aggregate-merge-errorResponse.yml +0 -42
  648. data/spec/spec_tests/data/crud_unified/aggregate-merge.yml +0 -185
  649. data/spec/spec_tests/data/crud_unified/aggregate-out-readConcern.yml +0 -171
  650. data/spec/spec_tests/data/crud_unified/aggregate-write-readPreference.yml +0 -161
  651. data/spec/spec_tests/data/crud_unified/aggregate.yml +0 -215
  652. data/spec/spec_tests/data/crud_unified/bulkWrite-arrayFilters-clientError.yml +0 -98
  653. data/spec/spec_tests/data/crud_unified/bulkWrite-arrayFilters.yml +0 -174
  654. data/spec/spec_tests/data/crud_unified/bulkWrite-comment.yml +0 -189
  655. data/spec/spec_tests/data/crud_unified/bulkWrite-delete-hint-clientError.yml +0 -113
  656. data/spec/spec_tests/data/crud_unified/bulkWrite-delete-hint-serverError.yml +0 -142
  657. data/spec/spec_tests/data/crud_unified/bulkWrite-delete-hint.yml +0 -154
  658. data/spec/spec_tests/data/crud_unified/bulkWrite-deleteMany-hint-unacknowledged.yml +0 -98
  659. data/spec/spec_tests/data/crud_unified/bulkWrite-deleteMany-let.yml +0 -86
  660. data/spec/spec_tests/data/crud_unified/bulkWrite-deleteOne-hint-unacknowledged.yml +0 -97
  661. data/spec/spec_tests/data/crud_unified/bulkWrite-deleteOne-let.yml +0 -86
  662. data/spec/spec_tests/data/crud_unified/bulkWrite-errorResponse.yml +0 -50
  663. data/spec/spec_tests/data/crud_unified/bulkWrite-insertOne-dots_and_dollars.yml +0 -138
  664. data/spec/spec_tests/data/crud_unified/bulkWrite-replaceOne-dots_and_dollars.yml +0 -165
  665. data/spec/spec_tests/data/crud_unified/bulkWrite-replaceOne-hint-unacknowledged.yml +0 -103
  666. data/spec/spec_tests/data/crud_unified/bulkWrite-replaceOne-let.yml +0 -93
  667. data/spec/spec_tests/data/crud_unified/bulkWrite-update-hint-clientError.yml +0 -148
  668. data/spec/spec_tests/data/crud_unified/bulkWrite-update-hint-serverError.yml +0 -239
  669. data/spec/spec_tests/data/crud_unified/bulkWrite-update-hint.yml +0 -256
  670. data/spec/spec_tests/data/crud_unified/bulkWrite-update-validation.yml +0 -73
  671. data/spec/spec_tests/data/crud_unified/bulkWrite-updateMany-dots_and_dollars.yml +0 -150
  672. data/spec/spec_tests/data/crud_unified/bulkWrite-updateMany-hint-unacknowledged.yml +0 -104
  673. data/spec/spec_tests/data/crud_unified/bulkWrite-updateMany-let.yml +0 -96
  674. data/spec/spec_tests/data/crud_unified/bulkWrite-updateOne-dots_and_dollars.yml +0 -150
  675. data/spec/spec_tests/data/crud_unified/bulkWrite-updateOne-hint-unacknowledged.yml +0 -103
  676. data/spec/spec_tests/data/crud_unified/bulkWrite-updateOne-let.yml +0 -95
  677. data/spec/spec_tests/data/crud_unified/countDocuments-comment.yml +0 -92
  678. data/spec/spec_tests/data/crud_unified/db-aggregate-write-readPreference.yml +0 -157
  679. data/spec/spec_tests/data/crud_unified/db-aggregate.yml +0 -73
  680. data/spec/spec_tests/data/crud_unified/deleteMany-comment.yml +0 -97
  681. data/spec/spec_tests/data/crud_unified/deleteMany-hint-clientError.yml +0 -87
  682. data/spec/spec_tests/data/crud_unified/deleteMany-hint-serverError.yml +0 -107
  683. data/spec/spec_tests/data/crud_unified/deleteMany-hint-unacknowledged.yml +0 -90
  684. data/spec/spec_tests/data/crud_unified/deleteMany-hint.yml +0 -99
  685. data/spec/spec_tests/data/crud_unified/deleteMany-let.yml +0 -93
  686. data/spec/spec_tests/data/crud_unified/deleteOne-comment.yml +0 -98
  687. data/spec/spec_tests/data/crud_unified/deleteOne-errorResponse.yml +0 -46
  688. data/spec/spec_tests/data/crud_unified/deleteOne-hint-clientError.yml +0 -80
  689. data/spec/spec_tests/data/crud_unified/deleteOne-hint-serverError.yml +0 -100
  690. data/spec/spec_tests/data/crud_unified/deleteOne-hint-unacknowledged.yml +0 -89
  691. data/spec/spec_tests/data/crud_unified/deleteOne-hint.yml +0 -95
  692. data/spec/spec_tests/data/crud_unified/deleteOne-let.yml +0 -91
  693. data/spec/spec_tests/data/crud_unified/distinct-comment.yml +0 -98
  694. data/spec/spec_tests/data/crud_unified/estimatedDocumentCount-comment.yml +0 -95
  695. data/spec/spec_tests/data/crud_unified/estimatedDocumentCount.yml +0 -181
  696. data/spec/spec_tests/data/crud_unified/find-allowdiskuse-clientError.yml +0 -55
  697. data/spec/spec_tests/data/crud_unified/find-allowdiskuse-serverError.yml +0 -68
  698. data/spec/spec_tests/data/crud_unified/find-allowdiskuse.yml +0 -79
  699. data/spec/spec_tests/data/crud_unified/find-comment.yml +0 -166
  700. data/spec/spec_tests/data/crud_unified/find-let.yml +0 -71
  701. data/spec/spec_tests/data/crud_unified/find-test-all-options.yml +0 -377
  702. data/spec/spec_tests/data/crud_unified/find.yml +0 -68
  703. data/spec/spec_tests/data/crud_unified/findOneAndDelete-comment.yml +0 -96
  704. data/spec/spec_tests/data/crud_unified/findOneAndDelete-hint-clientError.yml +0 -91
  705. data/spec/spec_tests/data/crud_unified/findOneAndDelete-hint-serverError.yml +0 -107
  706. data/spec/spec_tests/data/crud_unified/findOneAndDelete-hint-unacknowledged.yml +0 -88
  707. data/spec/spec_tests/data/crud_unified/findOneAndDelete-hint.yml +0 -102
  708. data/spec/spec_tests/data/crud_unified/findOneAndDelete-let.yml +0 -86
  709. data/spec/spec_tests/data/crud_unified/findOneAndReplace-comment.yml +0 -101
  710. data/spec/spec_tests/data/crud_unified/findOneAndReplace-dots_and_dollars.yml +0 -140
  711. data/spec/spec_tests/data/crud_unified/findOneAndReplace-hint-clientError.yml +0 -83
  712. data/spec/spec_tests/data/crud_unified/findOneAndReplace-hint-serverError.yml +0 -99
  713. data/spec/spec_tests/data/crud_unified/findOneAndReplace-hint-unacknowledged.yml +0 -96
  714. data/spec/spec_tests/data/crud_unified/findOneAndReplace-hint.yml +0 -98
  715. data/spec/spec_tests/data/crud_unified/findOneAndReplace-let.yml +0 -94
  716. data/spec/spec_tests/data/crud_unified/findOneAndUpdate-comment.yml +0 -95
  717. data/spec/spec_tests/data/crud_unified/findOneAndUpdate-dots_and_dollars.yml +0 -127
  718. data/spec/spec_tests/data/crud_unified/findOneAndUpdate-errorResponse.yml +0 -69
  719. data/spec/spec_tests/data/crud_unified/findOneAndUpdate-hint-clientError.yml +0 -84
  720. data/spec/spec_tests/data/crud_unified/findOneAndUpdate-hint-serverError.yml +0 -100
  721. data/spec/spec_tests/data/crud_unified/findOneAndUpdate-hint-unacknowledged.yml +0 -92
  722. data/spec/spec_tests/data/crud_unified/findOneAndUpdate-hint.yml +0 -99
  723. data/spec/spec_tests/data/crud_unified/findOneAndUpdate-let.yml +0 -96
  724. data/spec/spec_tests/data/crud_unified/insertMany-comment.yml +0 -93
  725. data/spec/spec_tests/data/crud_unified/insertMany-dots_and_dollars.yml +0 -128
  726. data/spec/spec_tests/data/crud_unified/insertOne-comment.yml +0 -91
  727. data/spec/spec_tests/data/crud_unified/insertOne-dots_and_dollars.yml +0 -238
  728. data/spec/spec_tests/data/crud_unified/insertOne-errorResponse.yml +0 -46
  729. data/spec/spec_tests/data/crud_unified/replaceOne-comment.yml +0 -105
  730. data/spec/spec_tests/data/crud_unified/replaceOne-dots_and_dollars.yml +0 -180
  731. data/spec/spec_tests/data/crud_unified/replaceOne-hint-unacknowledged.yml +0 -95
  732. data/spec/spec_tests/data/crud_unified/replaceOne-hint.yml +0 -108
  733. data/spec/spec_tests/data/crud_unified/replaceOne-let.yml +0 -98
  734. data/spec/spec_tests/data/crud_unified/replaceOne-validation.yml +0 -37
  735. data/spec/spec_tests/data/crud_unified/updateMany-comment.yml +0 -104
  736. data/spec/spec_tests/data/crud_unified/updateMany-dots_and_dollars.yml +0 -138
  737. data/spec/spec_tests/data/crud_unified/updateMany-hint-clientError.yml +0 -91
  738. data/spec/spec_tests/data/crud_unified/updateMany-hint-serverError.yml +0 -115
  739. data/spec/spec_tests/data/crud_unified/updateMany-hint-unacknowledged.yml +0 -96
  740. data/spec/spec_tests/data/crud_unified/updateMany-hint.yml +0 -115
  741. data/spec/spec_tests/data/crud_unified/updateMany-let.yml +0 -107
  742. data/spec/spec_tests/data/crud_unified/updateMany-validation.yml +0 -39
  743. data/spec/spec_tests/data/crud_unified/updateOne-comment.yml +0 -104
  744. data/spec/spec_tests/data/crud_unified/updateOne-dots_and_dollars.yml +0 -138
  745. data/spec/spec_tests/data/crud_unified/updateOne-errorResponse.yml +0 -47
  746. data/spec/spec_tests/data/crud_unified/updateOne-hint-clientError.yml +0 -85
  747. data/spec/spec_tests/data/crud_unified/updateOne-hint-serverError.yml +0 -109
  748. data/spec/spec_tests/data/crud_unified/updateOne-hint-unacknowledged.yml +0 -95
  749. data/spec/spec_tests/data/crud_unified/updateOne-hint.yml +0 -109
  750. data/spec/spec_tests/data/crud_unified/updateOne-let.yml +0 -102
  751. data/spec/spec_tests/data/crud_unified/updateOne-validation.yml +0 -37
  752. data/spec/spec_tests/data/crud_unified/updateWithPipelines.yml +0 -299
  753. data/spec/spec_tests/data/gridfs/delete.yml +0 -123
  754. data/spec/spec_tests/data/gridfs/download.yml +0 -192
  755. data/spec/spec_tests/data/gridfs/download_by_name.yml +0 -113
  756. data/spec/spec_tests/data/gridfs/upload.yml +0 -158
  757. data/spec/spec_tests/data/gridfs_unified/delete.yml +0 -198
  758. data/spec/spec_tests/data/gridfs_unified/download.yml +0 -241
  759. data/spec/spec_tests/data/gridfs_unified/downloadByName.yml +0 -159
  760. data/spec/spec_tests/data/gridfs_unified/upload-disableMD5.yml +0 -92
  761. data/spec/spec_tests/data/gridfs_unified/upload.yml +0 -288
  762. data/spec/spec_tests/data/index_management/createSearchIndex.yml +0 -64
  763. data/spec/spec_tests/data/index_management/createSearchIndexes.yml +0 -86
  764. data/spec/spec_tests/data/index_management/dropSearchIndex.yml +0 -43
  765. data/spec/spec_tests/data/index_management/listSearchIndexes.yml +0 -91
  766. data/spec/spec_tests/data/index_management/updateSearchIndex.yml +0 -46
  767. data/spec/spec_tests/data/load_balancers/event-monitoring.yml +0 -99
  768. data/spec/spec_tests/data/load_balancers/lb-connection-establishment.yml +0 -36
  769. data/spec/spec_tests/data/load_balancers/non-lb-connection-establishment.yml +0 -56
  770. data/spec/spec_tests/data/load_balancers/server-selection.yml +0 -50
  771. data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/DefaultNoMaxStaleness.yml +0 -26
  772. data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/Incompatible.yml +0 -25
  773. data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/LastUpdateTime.yml +0 -33
  774. data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/MaxStalenessTooSmall.yml +0 -15
  775. data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/Nearest.yml +0 -33
  776. data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/Nearest2.yml +0 -33
  777. data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/NoKnownServers.yml +0 -16
  778. data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/PrimaryPreferred.yml +0 -27
  779. data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/PrimaryPreferred_tags.yml +0 -36
  780. data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/Secondary.yml +0 -51
  781. data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/SecondaryPreferred.yml +0 -26
  782. data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/SecondaryPreferred_tags.yml +0 -51
  783. data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/ZeroMaxStaleness.yml +0 -23
  784. data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/DefaultNoMaxStaleness.yml +0 -26
  785. data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/Incompatible.yml +0 -25
  786. data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/LastUpdateTime.yml +0 -35
  787. data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/LongHeartbeat.yml +0 -29
  788. data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/LongHeartbeat2.yml +0 -25
  789. data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/MaxStalenessTooSmall.yml +0 -26
  790. data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/MaxStalenessWithModePrimary.yml +0 -23
  791. data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/Nearest.yml +0 -33
  792. data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/Nearest2.yml +0 -33
  793. data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/Nearest_tags.yml +0 -36
  794. data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/PrimaryPreferred.yml +0 -27
  795. data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/PrimaryPreferred_incompatible.yml +0 -27
  796. data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/SecondaryPreferred.yml +0 -26
  797. data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/SecondaryPreferred_tags.yml +0 -59
  798. data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/SecondaryPreferred_tags2.yml +0 -43
  799. data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/Secondary_tags.yml +0 -59
  800. data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/Secondary_tags2.yml +0 -43
  801. data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/ZeroMaxStaleness.yml +0 -23
  802. data/spec/spec_tests/data/max_staleness/Sharded/Incompatible.yml +0 -25
  803. data/spec/spec_tests/data/max_staleness/Sharded/SmallMaxStaleness.yml +0 -28
  804. data/spec/spec_tests/data/max_staleness/Single/Incompatible.yml +0 -18
  805. data/spec/spec_tests/data/max_staleness/Single/SmallMaxStaleness.yml +0 -20
  806. data/spec/spec_tests/data/max_staleness/Unknown/SmallMaxStaleness.yml +0 -15
  807. data/spec/spec_tests/data/read_write_concern/connection-string/read-concern.yml +0 -32
  808. data/spec/spec_tests/data/read_write_concern/connection-string/write-concern.yml +0 -79
  809. data/spec/spec_tests/data/read_write_concern/document/read-concern.yml +0 -37
  810. data/spec/spec_tests/data/read_write_concern/document/write-concern.yml +0 -100
  811. data/spec/spec_tests/data/read_write_concern/operation/default-write-concern-2.6.yml +0 -215
  812. data/spec/spec_tests/data/read_write_concern/operation/default-write-concern-3.2.yml +0 -58
  813. data/spec/spec_tests/data/read_write_concern/operation/default-write-concern-3.4.yml +0 -95
  814. data/spec/spec_tests/data/read_write_concern/operation/default-write-concern-4.2.yml +0 -36
  815. data/spec/spec_tests/data/retryable_reads/legacy/aggregate-merge.yml +0 -39
  816. data/spec/spec_tests/data/retryable_reads/legacy/aggregate-serverErrors.yml +0 -157
  817. data/spec/spec_tests/data/retryable_reads/legacy/aggregate.yml +0 -87
  818. data/spec/spec_tests/data/retryable_reads/legacy/changeStreams-client.watch-serverErrors.yml +0 -150
  819. data/spec/spec_tests/data/retryable_reads/legacy/changeStreams-client.watch.yml +0 -62
  820. data/spec/spec_tests/data/retryable_reads/legacy/changeStreams-db.coll.watch-serverErrors.yml +0 -150
  821. data/spec/spec_tests/data/retryable_reads/legacy/changeStreams-db.coll.watch.yml +0 -66
  822. data/spec/spec_tests/data/retryable_reads/legacy/changeStreams-db.watch-serverErrors.yml +0 -154
  823. data/spec/spec_tests/data/retryable_reads/legacy/changeStreams-db.watch.yml +0 -62
  824. data/spec/spec_tests/data/retryable_reads/legacy/count-serverErrors.yml +0 -150
  825. data/spec/spec_tests/data/retryable_reads/legacy/count.yml +0 -64
  826. data/spec/spec_tests/data/retryable_reads/legacy/countDocuments-serverErrors.yml +0 -150
  827. data/spec/spec_tests/data/retryable_reads/legacy/countDocuments.yml +0 -64
  828. data/spec/spec_tests/data/retryable_reads/legacy/distinct-serverErrors.yml +0 -156
  829. data/spec/spec_tests/data/retryable_reads/legacy/distinct.yml +0 -71
  830. data/spec/spec_tests/data/retryable_reads/legacy/estimatedDocumentCount-serverErrors.yml +0 -148
  831. data/spec/spec_tests/data/retryable_reads/legacy/estimatedDocumentCount.yml +0 -62
  832. data/spec/spec_tests/data/retryable_reads/legacy/find-serverErrors.yml +0 -160
  833. data/spec/spec_tests/data/retryable_reads/legacy/find.yml +0 -86
  834. data/spec/spec_tests/data/retryable_reads/legacy/findOne-serverErrors.yml +0 -154
  835. data/spec/spec_tests/data/retryable_reads/legacy/findOne.yml +0 -68
  836. data/spec/spec_tests/data/retryable_reads/legacy/gridfs-download-serverErrors.yml +0 -173
  837. data/spec/spec_tests/data/retryable_reads/legacy/gridfs-download.yml +0 -79
  838. data/spec/spec_tests/data/retryable_reads/legacy/gridfs-downloadByName-serverErrors.yml +0 -174
  839. data/spec/spec_tests/data/retryable_reads/legacy/gridfs-downloadByName.yml +0 -79
  840. data/spec/spec_tests/data/retryable_reads/legacy/listCollectionNames-serverErrors.yml +0 -143
  841. data/spec/spec_tests/data/retryable_reads/legacy/listCollectionNames.yml +0 -59
  842. data/spec/spec_tests/data/retryable_reads/legacy/listCollectionObjects-serverErrors.yml +0 -144
  843. data/spec/spec_tests/data/retryable_reads/legacy/listCollectionObjects.yml +0 -59
  844. data/spec/spec_tests/data/retryable_reads/legacy/listCollections-serverErrors.yml +0 -143
  845. data/spec/spec_tests/data/retryable_reads/legacy/listCollections.yml +0 -59
  846. data/spec/spec_tests/data/retryable_reads/legacy/listDatabaseNames-serverErrors.yml +0 -143
  847. data/spec/spec_tests/data/retryable_reads/legacy/listDatabaseNames.yml +0 -59
  848. data/spec/spec_tests/data/retryable_reads/legacy/listDatabaseObjects-serverErrors.yml +0 -144
  849. data/spec/spec_tests/data/retryable_reads/legacy/listDatabaseObjects.yml +0 -59
  850. data/spec/spec_tests/data/retryable_reads/legacy/listDatabases-serverErrors.yml +0 -144
  851. data/spec/spec_tests/data/retryable_reads/legacy/listDatabases.yml +0 -59
  852. data/spec/spec_tests/data/retryable_reads/legacy/listIndexNames-serverErrors.yml +0 -144
  853. data/spec/spec_tests/data/retryable_reads/legacy/listIndexNames.yml +0 -60
  854. data/spec/spec_tests/data/retryable_reads/legacy/listIndexes-serverErrors.yml +0 -145
  855. data/spec/spec_tests/data/retryable_reads/legacy/listIndexes.yml +0 -60
  856. data/spec/spec_tests/data/retryable_reads/legacy/mapReduce.yml +0 -62
  857. data/spec/spec_tests/data/retryable_reads/unified/handshakeError.yml +0 -1342
  858. data/spec/spec_tests/data/retryable_writes/legacy/bulkWrite-errorLabels.yml +0 -77
  859. data/spec/spec_tests/data/retryable_writes/legacy/bulkWrite-serverErrors.yml +0 -130
  860. data/spec/spec_tests/data/retryable_writes/legacy/bulkWrite.yml +0 -402
  861. data/spec/spec_tests/data/retryable_writes/legacy/deleteMany.yml +0 -22
  862. data/spec/spec_tests/data/retryable_writes/legacy/deleteOne-errorLabels.yml +0 -48
  863. data/spec/spec_tests/data/retryable_writes/legacy/deleteOne-serverErrors.yml +0 -73
  864. data/spec/spec_tests/data/retryable_writes/legacy/deleteOne.yml +0 -57
  865. data/spec/spec_tests/data/retryable_writes/legacy/findOneAndDelete-errorLabels.yml +0 -49
  866. data/spec/spec_tests/data/retryable_writes/legacy/findOneAndDelete-serverErrors.yml +0 -74
  867. data/spec/spec_tests/data/retryable_writes/legacy/findOneAndDelete.yml +0 -58
  868. data/spec/spec_tests/data/retryable_writes/legacy/findOneAndReplace-errorLabels.yml +0 -52
  869. data/spec/spec_tests/data/retryable_writes/legacy/findOneAndReplace-serverErrors.yml +0 -80
  870. data/spec/spec_tests/data/retryable_writes/legacy/findOneAndReplace.yml +0 -63
  871. data/spec/spec_tests/data/retryable_writes/legacy/findOneAndUpdate-errorLabels.yml +0 -52
  872. data/spec/spec_tests/data/retryable_writes/legacy/findOneAndUpdate-serverErrors.yml +0 -79
  873. data/spec/spec_tests/data/retryable_writes/legacy/findOneAndUpdate.yml +0 -62
  874. data/spec/spec_tests/data/retryable_writes/legacy/insertMany-errorLabels.yml +0 -54
  875. data/spec/spec_tests/data/retryable_writes/legacy/insertMany-serverErrors.yml +0 -84
  876. data/spec/spec_tests/data/retryable_writes/legacy/insertMany.yml +0 -74
  877. data/spec/spec_tests/data/retryable_writes/legacy/insertOne-errorLabels.yml +0 -44
  878. data/spec/spec_tests/data/retryable_writes/legacy/insertOne-serverErrors.yml +0 -527
  879. data/spec/spec_tests/data/retryable_writes/legacy/insertOne.yml +0 -61
  880. data/spec/spec_tests/data/retryable_writes/legacy/replaceOne-errorLabels.yml +0 -53
  881. data/spec/spec_tests/data/retryable_writes/legacy/replaceOne-serverErrors.yml +0 -82
  882. data/spec/spec_tests/data/retryable_writes/legacy/replaceOne.yml +0 -66
  883. data/spec/spec_tests/data/retryable_writes/legacy/updateMany.yml +0 -27
  884. data/spec/spec_tests/data/retryable_writes/legacy/updateOne-errorLabels.yml +0 -53
  885. data/spec/spec_tests/data/retryable_writes/legacy/updateOne-serverErrors.yml +0 -82
  886. data/spec/spec_tests/data/retryable_writes/legacy/updateOne.yml +0 -129
  887. data/spec/spec_tests/data/retryable_writes/unified/bulkWrite-serverErrors.yml +0 -93
  888. data/spec/spec_tests/data/retryable_writes/unified/handshakeError.yml +0 -785
  889. data/spec/spec_tests/data/retryable_writes/unified/insertOne-noWritesPerformedError.yml +0 -54
  890. data/spec/spec_tests/data/retryable_writes/unified/insertOne-serverErrors.yml +0 -75
  891. data/spec/spec_tests/data/run_command_unified/runCommand.yml +0 -319
  892. data/spec/spec_tests/data/sdam/errors/error_handling_handshake.yml +0 -55
  893. data/spec/spec_tests/data/sdam/errors/non-stale-network-error.yml +0 -47
  894. data/spec/spec_tests/data/sdam/errors/non-stale-network-timeout-error.yml +0 -38
  895. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-InterruptedAtShutdown.yml +0 -61
  896. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-InterruptedDueToReplStateChange.yml +0 -61
  897. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-LegacyNotPrimary.yml +0 -61
  898. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-NotPrimaryNoSecondaryOk.yml +0 -61
  899. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-NotPrimaryOrSecondary.yml +0 -61
  900. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-NotWritablePrimary.yml +0 -61
  901. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-PrimarySteppedDown.yml +0 -61
  902. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-ShutdownInProgress.yml +0 -61
  903. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-InterruptedAtShutdown.yml +0 -52
  904. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-InterruptedDueToReplStateChange.yml +0 -52
  905. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-LegacyNotPrimary.yml +0 -52
  906. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-NotPrimaryNoSecondaryOk.yml +0 -52
  907. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-NotPrimaryOrSecondary.yml +0 -52
  908. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-NotWritablePrimary.yml +0 -52
  909. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-PrimarySteppedDown.yml +0 -52
  910. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-ShutdownInProgress.yml +0 -52
  911. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-InterruptedAtShutdown.yml +0 -61
  912. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-InterruptedDueToReplStateChange.yml +0 -61
  913. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-LegacyNotPrimary.yml +0 -61
  914. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-NotPrimaryNoSecondaryOk.yml +0 -61
  915. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-NotPrimaryOrSecondary.yml +0 -61
  916. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-NotWritablePrimary.yml +0 -61
  917. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-PrimarySteppedDown.yml +0 -61
  918. data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-ShutdownInProgress.yml +0 -61
  919. data/spec/spec_tests/data/sdam/errors/post-42-InterruptedAtShutdown.yml +0 -47
  920. data/spec/spec_tests/data/sdam/errors/post-42-InterruptedDueToReplStateChange.yml +0 -47
  921. data/spec/spec_tests/data/sdam/errors/post-42-LegacyNotPrimary.yml +0 -47
  922. data/spec/spec_tests/data/sdam/errors/post-42-NotPrimaryNoSecondaryOk.yml +0 -47
  923. data/spec/spec_tests/data/sdam/errors/post-42-NotPrimaryOrSecondary.yml +0 -47
  924. data/spec/spec_tests/data/sdam/errors/post-42-NotWritablePrimary.yml +0 -47
  925. data/spec/spec_tests/data/sdam/errors/post-42-PrimarySteppedDown.yml +0 -47
  926. data/spec/spec_tests/data/sdam/errors/post-42-ShutdownInProgress.yml +0 -47
  927. data/spec/spec_tests/data/sdam/errors/pre-42-InterruptedAtShutdown.yml +0 -47
  928. data/spec/spec_tests/data/sdam/errors/pre-42-InterruptedDueToReplStateChange.yml +0 -47
  929. data/spec/spec_tests/data/sdam/errors/pre-42-LegacyNotPrimary.yml +0 -47
  930. data/spec/spec_tests/data/sdam/errors/pre-42-NotPrimaryNoSecondaryOk.yml +0 -47
  931. data/spec/spec_tests/data/sdam/errors/pre-42-NotPrimaryOrSecondary.yml +0 -47
  932. data/spec/spec_tests/data/sdam/errors/pre-42-NotWritablePrimary.yml +0 -47
  933. data/spec/spec_tests/data/sdam/errors/pre-42-PrimarySteppedDown.yml +0 -47
  934. data/spec/spec_tests/data/sdam/errors/pre-42-ShutdownInProgress.yml +0 -47
  935. data/spec/spec_tests/data/sdam/errors/prefer-error-code.yml +0 -54
  936. data/spec/spec_tests/data/sdam/errors/stale-generation-InterruptedAtShutdown.yml +0 -91
  937. data/spec/spec_tests/data/sdam/errors/stale-generation-InterruptedDueToReplStateChange.yml +0 -91
  938. data/spec/spec_tests/data/sdam/errors/stale-generation-NotPrimaryNoSecondaryOk.yml +0 -91
  939. data/spec/spec_tests/data/sdam/errors/stale-generation-NotPrimaryOrSecondary.yml +0 -91
  940. data/spec/spec_tests/data/sdam/errors/stale-generation-NotWritablePrimary.yml +0 -91
  941. data/spec/spec_tests/data/sdam/errors/stale-generation-PrimarySteppedDown.yml +0 -91
  942. data/spec/spec_tests/data/sdam/errors/stale-generation-ShutdownInProgress.yml +0 -91
  943. data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-InterruptedAtShutdown.yml +0 -91
  944. data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-InterruptedDueToReplStateChange.yml +0 -91
  945. data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-LegacyNotPrimary.yml +0 -91
  946. data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-NotPrimaryNoSecondaryOk.yml +0 -91
  947. data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-NotPrimaryOrSecondary.yml +0 -91
  948. data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-NotWritablePrimary.yml +0 -91
  949. data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-PrimarySteppedDown.yml +0 -91
  950. data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-ShutdownInProgress.yml +0 -91
  951. data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-network.yml +0 -82
  952. data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-timeout.yml +0 -82
  953. data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-InterruptedAtShutdown.yml +0 -91
  954. data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-InterruptedDueToReplStateChange.yml +0 -91
  955. data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-LegacyNotPrimary.yml +0 -91
  956. data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-NotPrimaryNoSecondaryOk.yml +0 -91
  957. data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-NotPrimaryOrSecondary.yml +0 -91
  958. data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-NotWritablePrimary.yml +0 -91
  959. data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-PrimarySteppedDown.yml +0 -91
  960. data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-ShutdownInProgress.yml +0 -91
  961. data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-network.yml +0 -82
  962. data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-timeout.yml +0 -82
  963. data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-InterruptedAtShutdown.yml +0 -65
  964. data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-InterruptedDueToReplStateChange.yml +0 -65
  965. data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-LegacyNotPrimary.yml +0 -65
  966. data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-NotPrimaryNoSecondaryOk.yml +0 -65
  967. data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-NotPrimaryOrSecondary.yml +0 -65
  968. data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-NotWritablePrimary.yml +0 -65
  969. data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-PrimarySteppedDown.yml +0 -65
  970. data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-ShutdownInProgress.yml +0 -65
  971. data/spec/spec_tests/data/sdam/errors/write_errors_ignored.yml +0 -42
  972. data/spec/spec_tests/data/sdam/load-balanced/discover_load_balancer.yml +0 -25
  973. data/spec/spec_tests/data/sdam/rs/compatible.yml +0 -45
  974. data/spec/spec_tests/data/sdam/rs/compatible_unknown.yml +0 -34
  975. data/spec/spec_tests/data/sdam/rs/discover_arbiters.yml +0 -44
  976. data/spec/spec_tests/data/sdam/rs/discover_arbiters_replicaset.yml +0 -44
  977. data/spec/spec_tests/data/sdam/rs/discover_ghost.yml +0 -36
  978. data/spec/spec_tests/data/sdam/rs/discover_ghost_replicaset.yml +0 -42
  979. data/spec/spec_tests/data/sdam/rs/discover_hidden.yml +0 -51
  980. data/spec/spec_tests/data/sdam/rs/discover_hidden_replicaset.yml +0 -51
  981. data/spec/spec_tests/data/sdam/rs/discover_passives.yml +0 -83
  982. data/spec/spec_tests/data/sdam/rs/discover_passives_replicaset.yml +0 -83
  983. data/spec/spec_tests/data/sdam/rs/discover_primary.yml +0 -43
  984. data/spec/spec_tests/data/sdam/rs/discover_primary_replicaset.yml +0 -43
  985. data/spec/spec_tests/data/sdam/rs/discover_rsother.yml +0 -50
  986. data/spec/spec_tests/data/sdam/rs/discover_rsother_replicaset.yml +0 -68
  987. data/spec/spec_tests/data/sdam/rs/discover_secondary.yml +0 -44
  988. data/spec/spec_tests/data/sdam/rs/discover_secondary_replicaset.yml +0 -44
  989. data/spec/spec_tests/data/sdam/rs/discovery.yml +0 -207
  990. data/spec/spec_tests/data/sdam/rs/electionId_precedence_setVersion.yml +0 -62
  991. data/spec/spec_tests/data/sdam/rs/equal_electionids.yml +0 -57
  992. data/spec/spec_tests/data/sdam/rs/hosts_differ_from_seeds.yml +0 -37
  993. data/spec/spec_tests/data/sdam/rs/incompatible_arbiter.yml +0 -36
  994. data/spec/spec_tests/data/sdam/rs/incompatible_ghost.yml +0 -34
  995. data/spec/spec_tests/data/sdam/rs/incompatible_other.yml +0 -36
  996. data/spec/spec_tests/data/sdam/rs/ls_timeout.yml +0 -249
  997. data/spec/spec_tests/data/sdam/rs/member_reconfig.yml +0 -74
  998. data/spec/spec_tests/data/sdam/rs/member_standalone.yml +0 -66
  999. data/spec/spec_tests/data/sdam/rs/new_primary.yml +0 -80
  1000. data/spec/spec_tests/data/sdam/rs/new_primary_new_electionid.yml +0 -119
  1001. data/spec/spec_tests/data/sdam/rs/new_primary_new_setversion.yml +0 -119
  1002. data/spec/spec_tests/data/sdam/rs/new_primary_wrong_set_name.yml +0 -77
  1003. data/spec/spec_tests/data/sdam/rs/non_rs_member.yml +0 -33
  1004. data/spec/spec_tests/data/sdam/rs/normalize_case.yml +0 -52
  1005. data/spec/spec_tests/data/sdam/rs/normalize_case_me.yml +0 -102
  1006. data/spec/spec_tests/data/sdam/rs/null_election_id-pre-6.0.yml +0 -175
  1007. data/spec/spec_tests/data/sdam/rs/null_election_id.yml +0 -177
  1008. data/spec/spec_tests/data/sdam/rs/primary_becomes_ghost.yml +0 -65
  1009. data/spec/spec_tests/data/sdam/rs/primary_becomes_mongos.yml +0 -58
  1010. data/spec/spec_tests/data/sdam/rs/primary_becomes_standalone.yml +0 -55
  1011. data/spec/spec_tests/data/sdam/rs/primary_changes_set_name.yml +0 -63
  1012. data/spec/spec_tests/data/sdam/rs/primary_disconnect.yml +0 -59
  1013. data/spec/spec_tests/data/sdam/rs/primary_disconnect_electionid.yml +0 -189
  1014. data/spec/spec_tests/data/sdam/rs/primary_disconnect_setversion.yml +0 -189
  1015. data/spec/spec_tests/data/sdam/rs/primary_hint_from_secondary_with_mismatched_me.yml +0 -64
  1016. data/spec/spec_tests/data/sdam/rs/primary_mismatched_me.yml +0 -27
  1017. data/spec/spec_tests/data/sdam/rs/primary_mismatched_me_not_removed.yml +0 -75
  1018. data/spec/spec_tests/data/sdam/rs/primary_reports_new_member.yml +0 -175
  1019. data/spec/spec_tests/data/sdam/rs/primary_to_no_primary_mismatched_me.yml +0 -81
  1020. data/spec/spec_tests/data/sdam/rs/primary_wrong_set_name.yml +0 -30
  1021. data/spec/spec_tests/data/sdam/rs/repeated.yml +0 -105
  1022. data/spec/spec_tests/data/sdam/rs/replicaset_rsnp.yml +0 -21
  1023. data/spec/spec_tests/data/sdam/rs/response_from_removed.yml +0 -69
  1024. data/spec/spec_tests/data/sdam/rs/ruby_primary_address_change.yml +0 -31
  1025. data/spec/spec_tests/data/sdam/rs/ruby_secondary_wrong_set_name_with_primary_second.yml +0 -73
  1026. data/spec/spec_tests/data/sdam/rs/sec_not_auth.yml +0 -55
  1027. data/spec/spec_tests/data/sdam/rs/secondary_ignore_ok_0-pre-6.0.yml +0 -87
  1028. data/spec/spec_tests/data/sdam/rs/secondary_ignore_ok_0.yml +0 -87
  1029. data/spec/spec_tests/data/sdam/rs/secondary_mismatched_me.yml +0 -28
  1030. data/spec/spec_tests/data/sdam/rs/secondary_wrong_set_name.yml +0 -31
  1031. data/spec/spec_tests/data/sdam/rs/secondary_wrong_set_name_with_primary.yml +0 -75
  1032. data/spec/spec_tests/data/sdam/rs/set_version_can_rollback.yml +0 -101
  1033. data/spec/spec_tests/data/sdam/rs/setversion_equal_max_without_electionid.yml +0 -78
  1034. data/spec/spec_tests/data/sdam/rs/setversion_greaterthan_max_without_electionid.yml +0 -79
  1035. data/spec/spec_tests/data/sdam/rs/setversion_without_electionid-pre-6.0.yml +0 -79
  1036. data/spec/spec_tests/data/sdam/rs/setversion_without_electionid.yml +0 -78
  1037. data/spec/spec_tests/data/sdam/rs/stepdown_change_set_name.yml +0 -65
  1038. data/spec/spec_tests/data/sdam/rs/too_new.yml +0 -45
  1039. data/spec/spec_tests/data/sdam/rs/too_old.yml +0 -41
  1040. data/spec/spec_tests/data/sdam/rs/topology_version_equal.yml +0 -68
  1041. data/spec/spec_tests/data/sdam/rs/topology_version_greater.yml +0 -194
  1042. data/spec/spec_tests/data/sdam/rs/topology_version_less.yml +0 -64
  1043. data/spec/spec_tests/data/sdam/rs/unexpected_mongos.yml +0 -29
  1044. data/spec/spec_tests/data/sdam/rs/use_setversion_without_electionid-pre-6.0.yml +0 -117
  1045. data/spec/spec_tests/data/sdam/rs/use_setversion_without_electionid.yml +0 -119
  1046. data/spec/spec_tests/data/sdam/rs/wrong_set_name.yml +0 -38
  1047. data/spec/spec_tests/data/sdam/sharded/compatible.yml +0 -40
  1048. data/spec/spec_tests/data/sdam/sharded/discover_single_mongos.yml +0 -24
  1049. data/spec/spec_tests/data/sdam/sharded/ls_timeout_mongos.yml +0 -101
  1050. data/spec/spec_tests/data/sdam/sharded/mongos_disconnect.yml +0 -113
  1051. data/spec/spec_tests/data/sdam/sharded/multiple_mongoses.yml +0 -52
  1052. data/spec/spec_tests/data/sdam/sharded/non_mongos_removed.yml +0 -47
  1053. data/spec/spec_tests/data/sdam/sharded/normalize_uri_case.yml +0 -32
  1054. data/spec/spec_tests/data/sdam/sharded/ruby_primary_different_address.yml +0 -21
  1055. data/spec/spec_tests/data/sdam/sharded/ruby_primary_mismatched_me.yml +0 -22
  1056. data/spec/spec_tests/data/sdam/sharded/too_new.yml +0 -38
  1057. data/spec/spec_tests/data/sdam/sharded/too_old.yml +0 -38
  1058. data/spec/spec_tests/data/sdam/single/compatible.yml +0 -27
  1059. data/spec/spec_tests/data/sdam/single/direct_connection_external_ip.yml +0 -37
  1060. data/spec/spec_tests/data/sdam/single/direct_connection_mongos.yml +0 -36
  1061. data/spec/spec_tests/data/sdam/single/direct_connection_replicaset.yml +0 -23
  1062. data/spec/spec_tests/data/sdam/single/direct_connection_rsarbiter.yml +0 -38
  1063. data/spec/spec_tests/data/sdam/single/direct_connection_rsprimary.yml +0 -37
  1064. data/spec/spec_tests/data/sdam/single/direct_connection_rssecondary.yml +0 -38
  1065. data/spec/spec_tests/data/sdam/single/direct_connection_standalone.yml +0 -35
  1066. data/spec/spec_tests/data/sdam/single/direct_connection_unavailable_seed.yml +0 -28
  1067. data/spec/spec_tests/data/sdam/single/direct_connection_wrong_set_name.yml +0 -40
  1068. data/spec/spec_tests/data/sdam/single/discover_standalone.yml +0 -35
  1069. data/spec/spec_tests/data/sdam/single/discover_unavailable_seed.yml +0 -28
  1070. data/spec/spec_tests/data/sdam/single/ls_timeout_standalone.yml +0 -36
  1071. data/spec/spec_tests/data/sdam/single/not_ok_response.yml +0 -44
  1072. data/spec/spec_tests/data/sdam/single/ruby_primary_different_address.yml +0 -24
  1073. data/spec/spec_tests/data/sdam/single/ruby_primary_mismatched_me.yml +0 -25
  1074. data/spec/spec_tests/data/sdam/single/standalone_removed.yml +0 -35
  1075. data/spec/spec_tests/data/sdam/single/standalone_using_legacy_hello.yml +0 -34
  1076. data/spec/spec_tests/data/sdam/single/too_new.yml +0 -27
  1077. data/spec/spec_tests/data/sdam/single/too_old.yml +0 -25
  1078. data/spec/spec_tests/data/sdam/single/too_old_then_upgraded.yml +0 -48
  1079. data/spec/spec_tests/data/sdam_monitoring/discovered_standalone.yml +0 -70
  1080. data/spec/spec_tests/data/sdam_monitoring/load_balancer.yml +0 -65
  1081. data/spec/spec_tests/data/sdam_monitoring/replica_set_other_chain.yml +0 -222
  1082. data/spec/spec_tests/data/sdam_monitoring/replica_set_other_change.yml +0 -225
  1083. data/spec/spec_tests/data/sdam_monitoring/replica_set_primary_address_change.yml +0 -251
  1084. data/spec/spec_tests/data/sdam_monitoring/replica_set_with_me_mismatch.yml +0 -111
  1085. data/spec/spec_tests/data/sdam_monitoring/replica_set_with_no_primary.yml +0 -112
  1086. data/spec/spec_tests/data/sdam_monitoring/replica_set_with_primary.yml +0 -111
  1087. data/spec/spec_tests/data/sdam_monitoring/replica_set_with_primary_and_secondary.yml +0 -198
  1088. data/spec/spec_tests/data/sdam_monitoring/replica_set_with_primary_removal.yml +0 -175
  1089. data/spec/spec_tests/data/sdam_monitoring/replica_set_with_removal.yml +0 -111
  1090. data/spec/spec_tests/data/sdam_monitoring/replica_set_with_second_seed_removal.yml +0 -106
  1091. data/spec/spec_tests/data/sdam_monitoring/required_replica_set.yml +0 -108
  1092. data/spec/spec_tests/data/sdam_monitoring/standalone.yml +0 -70
  1093. data/spec/spec_tests/data/sdam_monitoring/standalone_repeated.yml +0 -86
  1094. data/spec/spec_tests/data/sdam_monitoring/standalone_suppress_equal_description_changes.yml +0 -73
  1095. data/spec/spec_tests/data/sdam_monitoring/standalone_to_rs_with_me_mismatch.yml +0 -90
  1096. data/spec/spec_tests/data/sdam_unified/auth-error.yml +0 -130
  1097. data/spec/spec_tests/data/sdam_unified/auth-misc-command-error.yml +0 -132
  1098. data/spec/spec_tests/data/sdam_unified/auth-network-error.yml +0 -132
  1099. data/spec/spec_tests/data/sdam_unified/auth-network-timeout-error.yml +0 -138
  1100. data/spec/spec_tests/data/sdam_unified/auth-shutdown-error.yml +0 -133
  1101. data/spec/spec_tests/data/sdam_unified/cancel-server-check.yml +0 -143
  1102. data/spec/spec_tests/data/sdam_unified/connectTimeoutMS.yml +0 -130
  1103. data/spec/spec_tests/data/sdam_unified/find-network-error.yml +0 -135
  1104. data/spec/spec_tests/data/sdam_unified/find-network-timeout-error.yml +0 -119
  1105. data/spec/spec_tests/data/sdam_unified/find-shutdown-error.yml +0 -163
  1106. data/spec/spec_tests/data/sdam_unified/hello-command-error.yml +0 -233
  1107. data/spec/spec_tests/data/sdam_unified/hello-network-error.yml +0 -228
  1108. data/spec/spec_tests/data/sdam_unified/hello-timeout.yml +0 -318
  1109. data/spec/spec_tests/data/sdam_unified/insert-network-error.yml +0 -137
  1110. data/spec/spec_tests/data/sdam_unified/insert-shutdown-error.yml +0 -162
  1111. data/spec/spec_tests/data/sdam_unified/interruptInUse-pool-clear.yml +0 -340
  1112. data/spec/spec_tests/data/sdam_unified/minPoolSize-error.yml +0 -125
  1113. data/spec/spec_tests/data/sdam_unified/pool-cleared-error.yml +0 -239
  1114. data/spec/spec_tests/data/sdam_unified/rediscover-quickly-after-step-down.yml +0 -144
  1115. data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-directConnection.yml +0 -14
  1116. data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-no-results.yml +0 -5
  1117. data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-replicaSet-errors.yml +0 -6
  1118. data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-true-multiple-hosts.yml +0 -5
  1119. data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-true-txt.yml +0 -11
  1120. data/spec/spec_tests/data/seed_list_discovery/load-balanced/srvMaxHosts-conflicts_with_loadBalanced-true-txt.yml +0 -5
  1121. data/spec/spec_tests/data/seed_list_discovery/load-balanced/srvMaxHosts-conflicts_with_loadBalanced-true.yml +0 -5
  1122. data/spec/spec_tests/data/seed_list_discovery/load-balanced/srvMaxHosts-zero-txt.yml +0 -11
  1123. data/spec/spec_tests/data/seed_list_discovery/load-balanced/srvMaxHosts-zero.yml +0 -11
  1124. data/spec/spec_tests/data/seed_list_discovery/replica-set/direct-connection-false.yml +0 -10
  1125. data/spec/spec_tests/data/seed_list_discovery/replica-set/direct-connection-true.yml +0 -5
  1126. data/spec/spec_tests/data/seed_list_discovery/replica-set/encoded-userinfo-and-db.yml +0 -15
  1127. data/spec/spec_tests/data/seed_list_discovery/replica-set/loadBalanced-false-txt.yml +0 -10
  1128. data/spec/spec_tests/data/seed_list_discovery/replica-set/longer-parent-in-return.yml +0 -11
  1129. data/spec/spec_tests/data/seed_list_discovery/replica-set/misformatted-option.yml +0 -5
  1130. data/spec/spec_tests/data/seed_list_discovery/replica-set/no-results.yml +0 -5
  1131. data/spec/spec_tests/data/seed_list_discovery/replica-set/not-enough-parts.yml +0 -5
  1132. data/spec/spec_tests/data/seed_list_discovery/replica-set/one-result-default-port.yml +0 -10
  1133. data/spec/spec_tests/data/seed_list_discovery/replica-set/one-txt-record-multiple-strings.yml +0 -10
  1134. data/spec/spec_tests/data/seed_list_discovery/replica-set/one-txt-record.yml +0 -11
  1135. data/spec/spec_tests/data/seed_list_discovery/replica-set/parent-part-mismatch1.yml +0 -5
  1136. data/spec/spec_tests/data/seed_list_discovery/replica-set/parent-part-mismatch2.yml +0 -5
  1137. data/spec/spec_tests/data/seed_list_discovery/replica-set/parent-part-mismatch3.yml +0 -5
  1138. data/spec/spec_tests/data/seed_list_discovery/replica-set/parent-part-mismatch4.yml +0 -5
  1139. data/spec/spec_tests/data/seed_list_discovery/replica-set/parent-part-mismatch5.yml +0 -5
  1140. data/spec/spec_tests/data/seed_list_discovery/replica-set/returned-parent-too-short.yml +0 -5
  1141. data/spec/spec_tests/data/seed_list_discovery/replica-set/returned-parent-wrong.yml +0 -5
  1142. data/spec/spec_tests/data/seed_list_discovery/replica-set/srv-service-name.yml +0 -11
  1143. data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-conflicts_with_replicaSet-txt.yml +0 -5
  1144. data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-conflicts_with_replicaSet.yml +0 -5
  1145. data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-equal_to_srv_records.yml +0 -16
  1146. data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-greater_than_srv_records.yml +0 -15
  1147. data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-less_than_srv_records.yml +0 -15
  1148. data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-zero-txt.yml +0 -15
  1149. data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-zero.yml +0 -15
  1150. data/spec/spec_tests/data/seed_list_discovery/replica-set/two-results-default-port.yml +0 -11
  1151. data/spec/spec_tests/data/seed_list_discovery/replica-set/two-results-nonstandard-port.yml +0 -11
  1152. data/spec/spec_tests/data/seed_list_discovery/replica-set/two-txt-records.yml +0 -5
  1153. data/spec/spec_tests/data/seed_list_discovery/replica-set/txt-record-not-allowed-option.yml +0 -5
  1154. data/spec/spec_tests/data/seed_list_discovery/replica-set/txt-record-with-overridden-ssl-option.yml +0 -11
  1155. data/spec/spec_tests/data/seed_list_discovery/replica-set/txt-record-with-overridden-uri-option.yml +0 -11
  1156. data/spec/spec_tests/data/seed_list_discovery/replica-set/txt-record-with-unallowed-option.yml +0 -5
  1157. data/spec/spec_tests/data/seed_list_discovery/replica-set/uri-with-admin-database.yml +0 -13
  1158. data/spec/spec_tests/data/seed_list_discovery/replica-set/uri-with-auth.yml +0 -12
  1159. data/spec/spec_tests/data/seed_list_discovery/replica-set/uri-with-port.yml +0 -5
  1160. data/spec/spec_tests/data/seed_list_discovery/replica-set/uri-with-two-hosts.yml +0 -5
  1161. data/spec/spec_tests/data/seed_list_discovery/sharded/srvMaxHosts-equal_to_srv_records.yml +0 -13
  1162. data/spec/spec_tests/data/seed_list_discovery/sharded/srvMaxHosts-greater_than_srv_records.yml +0 -12
  1163. data/spec/spec_tests/data/seed_list_discovery/sharded/srvMaxHosts-less_than_srv_records.yml +0 -10
  1164. data/spec/spec_tests/data/seed_list_discovery/sharded/srvMaxHosts-zero.yml +0 -11
  1165. data/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/Nearest.yml +0 -25
  1166. data/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/Nearest_multiple.yml +0 -26
  1167. data/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/Nearest_non_matching.yml +0 -20
  1168. data/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/PossiblePrimary.yml +0 -15
  1169. data/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/PossiblePrimaryNearest.yml +0 -15
  1170. data/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/Primary.yml +0 -18
  1171. data/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/PrimaryPreferred.yml +0 -25
  1172. data/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/PrimaryPreferred_non_matching.yml +0 -20
  1173. data/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/Secondary.yml +0 -25
  1174. data/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/SecondaryPreferred.yml +0 -25
  1175. data/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/SecondaryPreferred_non_matching.yml +0 -20
  1176. data/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/Secondary_multi_tags.yml +0 -31
  1177. data/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/Secondary_multi_tags2.yml +0 -31
  1178. data/spec/spec_tests/data/server_selection/ReplicaSetNoPrimary/read/Secondary_non_matching.yml +0 -20
  1179. data/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/Nearest.yml +0 -32
  1180. data/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/Nearest_multiple.yml +0 -33
  1181. data/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/Nearest_non_matching.yml +0 -25
  1182. data/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/Primary.yml +0 -26
  1183. data/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/PrimaryPreferred.yml +0 -28
  1184. data/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/PrimaryPreferred_non_matching.yml +0 -28
  1185. data/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/Secondary.yml +0 -30
  1186. data/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/SecondaryPreferred.yml +0 -30
  1187. data/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/SecondaryPreferred_non_matching.yml +0 -28
  1188. data/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/SecondaryPreferred_tags.yml +0 -28
  1189. data/spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/Secondary_non_matching.yml +0 -25
  1190. data/spec/spec_tests/data/server_selection/Sharded/read/Nearest.yml +0 -21
  1191. data/spec/spec_tests/data/server_selection/Sharded/read/Primary.yml +0 -19
  1192. data/spec/spec_tests/data/server_selection/Sharded/read/PrimaryPreferred.yml +0 -21
  1193. data/spec/spec_tests/data/server_selection/Sharded/read/Secondary.yml +0 -21
  1194. data/spec/spec_tests/data/server_selection/Sharded/read/SecondaryPreferred.yml +0 -21
  1195. data/spec/spec_tests/data/server_selection/Single/read/SecondaryPreferred.yml +0 -18
  1196. data/spec/spec_tests/data/server_selection/Unknown/read/SecondaryPreferred.yml +0 -10
  1197. data/spec/spec_tests/data/server_selection/Unknown/read/ghost.yml +0 -11
  1198. data/spec/spec_tests/data/server_selection/Unknown/write/ghost.yml +0 -11
  1199. data/spec/spec_tests/data/server_selection_rtt/first_value.yml +0 -4
  1200. data/spec/spec_tests/data/server_selection_rtt/first_value_zero.yml +0 -4
  1201. data/spec/spec_tests/data/server_selection_rtt/value_test_1.yml +0 -4
  1202. data/spec/spec_tests/data/server_selection_rtt/value_test_2.yml +0 -4
  1203. data/spec/spec_tests/data/server_selection_rtt/value_test_3.yml +0 -4
  1204. data/spec/spec_tests/data/server_selection_rtt/value_test_4.yml +0 -4
  1205. data/spec/spec_tests/data/server_selection_rtt/value_test_5.yml +0 -4
  1206. data/spec/spec_tests/data/sessions_unified/driver-sessions-dirty-session-errors.yml +0 -351
  1207. data/spec/spec_tests/data/sessions_unified/driver-sessions-server-support.yml +0 -123
  1208. data/spec/spec_tests/data/sessions_unified/implicit-sessions-default-causal-consistency.yml +0 -119
  1209. data/spec/spec_tests/data/sessions_unified/snapshot-sessions-not-supported-client-error.yml +0 -75
  1210. data/spec/spec_tests/data/sessions_unified/snapshot-sessions-not-supported-server-error.yml +0 -102
  1211. data/spec/spec_tests/data/sessions_unified/snapshot-sessions-unsupported-ops.yml +0 -258
  1212. data/spec/spec_tests/data/sessions_unified/snapshot-sessions.yml +0 -482
  1213. data/spec/spec_tests/data/transactions/abort.yml +0 -413
  1214. data/spec/spec_tests/data/transactions/bulk.yml +0 -267
  1215. data/spec/spec_tests/data/transactions/causal-consistency.yml +0 -175
  1216. data/spec/spec_tests/data/transactions/commit.yml +0 -603
  1217. data/spec/spec_tests/data/transactions/count.yml +0 -67
  1218. data/spec/spec_tests/data/transactions/create-collection.yml +0 -131
  1219. data/spec/spec_tests/data/transactions/create-index.yml +0 -152
  1220. data/spec/spec_tests/data/transactions/delete.yml +0 -192
  1221. data/spec/spec_tests/data/transactions/error-labels.yml +0 -1030
  1222. data/spec/spec_tests/data/transactions/errors-client.yml +0 -55
  1223. data/spec/spec_tests/data/transactions/errors.yml +0 -133
  1224. data/spec/spec_tests/data/transactions/findOneAndDelete.yml +0 -134
  1225. data/spec/spec_tests/data/transactions/findOneAndReplace.yml +0 -148
  1226. data/spec/spec_tests/data/transactions/findOneAndUpdate.yml +0 -236
  1227. data/spec/spec_tests/data/transactions/insert.yml +0 -390
  1228. data/spec/spec_tests/data/transactions/isolation.yml +0 -133
  1229. data/spec/spec_tests/data/transactions/mongos-pin-auto.yml +0 -1674
  1230. data/spec/spec_tests/data/transactions/mongos-recovery-token.yml +0 -350
  1231. data/spec/spec_tests/data/transactions/pin-mongos.yml +0 -559
  1232. data/spec/spec_tests/data/transactions/read-concern.yml +0 -623
  1233. data/spec/spec_tests/data/transactions/read-pref.yml +0 -348
  1234. data/spec/spec_tests/data/transactions/reads.yml +0 -261
  1235. data/spec/spec_tests/data/transactions/retryable-abort-errorLabels.yml +0 -124
  1236. data/spec/spec_tests/data/transactions/retryable-abort.yml +0 -1315
  1237. data/spec/spec_tests/data/transactions/retryable-commit-errorLabels.yml +0 -132
  1238. data/spec/spec_tests/data/transactions/retryable-commit.yml +0 -1460
  1239. data/spec/spec_tests/data/transactions/retryable-writes.yml +0 -216
  1240. data/spec/spec_tests/data/transactions/run-command.yml +0 -197
  1241. data/spec/spec_tests/data/transactions/transaction-options-repl.yml +0 -117
  1242. data/spec/spec_tests/data/transactions/transaction-options.yml +0 -781
  1243. data/spec/spec_tests/data/transactions/update.yml +0 -246
  1244. data/spec/spec_tests/data/transactions/write-concern.yml +0 -554
  1245. data/spec/spec_tests/data/transactions_api/callback-aborts.yml +0 -170
  1246. data/spec/spec_tests/data/transactions_api/callback-commits.yml +0 -204
  1247. data/spec/spec_tests/data/transactions_api/callback-retry.yml +0 -215
  1248. data/spec/spec_tests/data/transactions_api/commit-retry.yml +0 -324
  1249. data/spec/spec_tests/data/transactions_api/commit-transienttransactionerror-4.2.yml +0 -139
  1250. data/spec/spec_tests/data/transactions_api/commit-transienttransactionerror.yml +0 -175
  1251. data/spec/spec_tests/data/transactions_api/commit-writeconcernerror.yml +0 -216
  1252. data/spec/spec_tests/data/transactions_api/commit.yml +0 -193
  1253. data/spec/spec_tests/data/transactions_api/transaction-options.yml +0 -274
  1254. data/spec/spec_tests/data/transactions_unified/do-not-retry-read-in-transaction.yml +0 -64
  1255. data/spec/spec_tests/data/transactions_unified/mongos-unpin.yml +0 -172
  1256. data/spec/spec_tests/data/transactions_unified/retryable-abort-handshake.yml +0 -118
  1257. data/spec/spec_tests/data/transactions_unified/retryable-commit-handshake.yml +0 -118
  1258. data/spec/spec_tests/data/unified/valid-fail/entity-findCursor-malformed.yml +0 -31
  1259. data/spec/spec_tests/data/unified/valid-fail/entity-findCursor.yml +0 -31
  1260. data/spec/spec_tests/data/unified/valid-fail/ignoreResultAndError-malformed.yml +0 -34
  1261. data/spec/spec_tests/data/unified/valid-fail/ignoreResultAndError.yml +0 -35
  1262. data/spec/spec_tests/data/unified/valid-fail/operation-failure.yml +0 -31
  1263. data/spec/spec_tests/data/unified/valid-fail/operation-unsupported.yml +0 -13
  1264. data/spec/spec_tests/data/unified/valid-pass/assertNumberConnectionsCheckedOut.yml +0 -17
  1265. data/spec/spec_tests/data/unified/valid-pass/collectionData-createOptions.yml +0 -37
  1266. data/spec/spec_tests/data/unified/valid-pass/entity-client-cmap-events.yml +0 -40
  1267. data/spec/spec_tests/data/unified/valid-pass/entity-client-storeEventsAsEntities.yml +0 -37
  1268. data/spec/spec_tests/data/unified/valid-pass/expectedError-errorResponse.yml +0 -39
  1269. data/spec/spec_tests/data/unified/valid-pass/expectedEventsForClient-eventType.yml +0 -66
  1270. data/spec/spec_tests/data/unified/valid-pass/expectedEventsForClient-ignoreExtraEvents.yml +0 -78
  1271. data/spec/spec_tests/data/unified/valid-pass/ignoreResultAndError.yml +0 -34
  1272. data/spec/spec_tests/data/unified/valid-pass/observeSensitiveCommands.yml +0 -255
  1273. data/spec/spec_tests/data/unified/valid-pass/poc-change-streams.yml +0 -241
  1274. data/spec/spec_tests/data/unified/valid-pass/poc-command-monitoring.yml +0 -102
  1275. data/spec/spec_tests/data/unified/valid-pass/poc-crud.yml +0 -190
  1276. data/spec/spec_tests/data/unified/valid-pass/poc-gridfs.yml +0 -155
  1277. data/spec/spec_tests/data/unified/valid-pass/poc-retryable-reads.yml +0 -193
  1278. data/spec/spec_tests/data/unified/valid-pass/poc-retryable-writes.yml +0 -210
  1279. data/spec/spec_tests/data/unified/valid-pass/poc-sessions.yml +0 -214
  1280. data/spec/spec_tests/data/unified/valid-pass/poc-transactions-convenient-api.yml +0 -235
  1281. data/spec/spec_tests/data/unified/valid-pass/poc-transactions-mongos-pin-auto.yml +0 -169
  1282. data/spec/spec_tests/data/unified/valid-pass/poc-transactions.yml +0 -171
  1283. data/spec/spec_tests/data/uri_options/auth-options.yml +0 -49
  1284. data/spec/spec_tests/data/uri_options/compression-options.yml +0 -51
  1285. data/spec/spec_tests/data/uri_options/concern-options.yml +0 -55
  1286. data/spec/spec_tests/data/uri_options/connection-options.yml +0 -209
  1287. data/spec/spec_tests/data/uri_options/connection-pool-options.yml +0 -26
  1288. data/spec/spec_tests/data/uri_options/read-preference-options.yml +0 -66
  1289. data/spec/spec_tests/data/uri_options/ruby-auth-options.yml +0 -12
  1290. data/spec/spec_tests/data/uri_options/ruby-connection-options.yml +0 -58
  1291. data/spec/spec_tests/data/uri_options/srv-options.yml +0 -96
  1292. data/spec/spec_tests/data/uri_options/tls-options.yml +0 -364
  1293. data/spec/spec_tests/data/versioned_api/crud-api-version-1-strict.yml +0 -419
  1294. data/spec/spec_tests/data/versioned_api/crud-api-version-1.yml +0 -413
  1295. data/spec/spec_tests/data/versioned_api/runcommand-helper-no-api-version-declared.yml +0 -75
  1296. data/spec/spec_tests/data/versioned_api/test-commands-deprecation-errors.yml +0 -47
  1297. data/spec/spec_tests/data/versioned_api/test-commands-strict-mode.yml +0 -46
  1298. data/spec/spec_tests/data/versioned_api/transaction-handling.yml +0 -128
  1299. data/spec/spec_tests/gridfs_spec.rb +0 -55
  1300. data/spec/spec_tests/gridfs_unified_spec.rb +0 -13
  1301. data/spec/spec_tests/index_management_unified_spec.rb +0 -13
  1302. data/spec/spec_tests/load_balancers_spec.rb +0 -15
  1303. data/spec/spec_tests/max_staleness_spec.rb +0 -12
  1304. data/spec/spec_tests/read_write_concern_connection_string_spec.rb +0 -13
  1305. data/spec/spec_tests/read_write_concern_document_spec.rb +0 -77
  1306. data/spec/spec_tests/read_write_concern_operaton_spec.rb +0 -13
  1307. data/spec/spec_tests/retryable_reads_spec.rb +0 -55
  1308. data/spec/spec_tests/retryable_reads_unified_spec.rb +0 -22
  1309. data/spec/spec_tests/retryable_writes_spec.rb +0 -25
  1310. data/spec/spec_tests/retryable_writes_unified_spec.rb +0 -21
  1311. data/spec/spec_tests/run_command_unified_spec.rb +0 -13
  1312. data/spec/spec_tests/sdam_monitoring_spec.rb +0 -101
  1313. data/spec/spec_tests/sdam_spec.rb +0 -246
  1314. data/spec/spec_tests/sdam_unified_spec.rb +0 -15
  1315. data/spec/spec_tests/seed_list_discovery_spec.rb +0 -127
  1316. data/spec/spec_tests/server_selection_rtt_spec.rb +0 -33
  1317. data/spec/spec_tests/server_selection_spec.rb +0 -12
  1318. data/spec/spec_tests/sessions_unified_spec.rb +0 -13
  1319. data/spec/spec_tests/transactions_api_spec.rb +0 -13
  1320. data/spec/spec_tests/transactions_spec.rb +0 -13
  1321. data/spec/spec_tests/transactions_unified_spec.rb +0 -14
  1322. data/spec/spec_tests/unified_spec.rb +0 -18
  1323. data/spec/spec_tests/uri_options_spec.rb +0 -93
  1324. data/spec/spec_tests/versioned_api_spec.rb +0 -13
  1325. data/spec/stress/cleanup_spec.rb +0 -61
  1326. data/spec/stress/connection_pool_stress_spec.rb +0 -143
  1327. data/spec/stress/connection_pool_timing_spec.rb +0 -160
  1328. data/spec/stress/fork_reconnect_stress_spec.rb +0 -108
  1329. data/spec/stress/push_monitor_close_spec.rb +0 -44
  1330. data/spec/support/authorization.rb +0 -161
  1331. data/spec/support/aws_utils/base.rb +0 -137
  1332. data/spec/support/aws_utils/inspector.rb +0 -227
  1333. data/spec/support/aws_utils/orchestrator.rb +0 -385
  1334. data/spec/support/aws_utils/provisioner.rb +0 -363
  1335. data/spec/support/aws_utils.rb +0 -66
  1336. data/spec/support/background_thread_registry.rb +0 -60
  1337. data/spec/support/certificates/README.md +0 -106
  1338. data/spec/support/certificates/atlas-ocsp-ca.crt +0 -113
  1339. data/spec/support/certificates/atlas-ocsp.crt +0 -147
  1340. data/spec/support/certificates/ca.crt +0 -76
  1341. data/spec/support/certificates/client-encrypted.key +0 -30
  1342. data/spec/support/certificates/client-int.crt +0 -78
  1343. data/spec/support/certificates/client-second-level-bundle.pem +0 -179
  1344. data/spec/support/certificates/client-second-level.crt +0 -74
  1345. data/spec/support/certificates/client-second-level.key +0 -27
  1346. data/spec/support/certificates/client-second-level.pem +0 -101
  1347. data/spec/support/certificates/client-x509.crt +0 -78
  1348. data/spec/support/certificates/client-x509.key +0 -27
  1349. data/spec/support/certificates/client-x509.pem +0 -105
  1350. data/spec/support/certificates/client.crt +0 -74
  1351. data/spec/support/certificates/client.key +0 -27
  1352. data/spec/support/certificates/client.pem +0 -101
  1353. data/spec/support/certificates/crl.pem +0 -12
  1354. data/spec/support/certificates/crl_client_revoked.pem +0 -13
  1355. data/spec/support/certificates/multi-ca.crt +0 -152
  1356. data/spec/support/certificates/python-ca.crt +0 -76
  1357. data/spec/support/certificates/retrieve-atlas-cert +0 -40
  1358. data/spec/support/certificates/server-int.crt +0 -78
  1359. data/spec/support/certificates/server-second-level-bundle.pem +0 -179
  1360. data/spec/support/certificates/server-second-level.crt +0 -74
  1361. data/spec/support/certificates/server-second-level.key +0 -27
  1362. data/spec/support/certificates/server-second-level.pem +0 -101
  1363. data/spec/support/certificates/server.pem +0 -101
  1364. data/spec/support/client_registry.rb +0 -258
  1365. data/spec/support/client_registry_macros.rb +0 -26
  1366. data/spec/support/cluster_tools.rb +0 -384
  1367. data/spec/support/common_shortcuts.rb +0 -421
  1368. data/spec/support/constraints.rb +0 -39
  1369. data/spec/support/crypt/corpus/corpus-encrypted.json +0 -9515
  1370. data/spec/support/crypt/corpus/corpus-key-aws.json +0 -33
  1371. data/spec/support/crypt/corpus/corpus-key-azure.json +0 -33
  1372. data/spec/support/crypt/corpus/corpus-key-gcp.json +0 -35
  1373. data/spec/support/crypt/corpus/corpus-key-kmip.json +0 -32
  1374. data/spec/support/crypt/corpus/corpus-key-local.json +0 -31
  1375. data/spec/support/crypt/corpus/corpus-schema.json +0 -6335
  1376. data/spec/support/crypt/corpus/corpus.json +0 -8619
  1377. data/spec/support/crypt/data_keys/key_document_aws.json +0 -34
  1378. data/spec/support/crypt/data_keys/key_document_azure.json +0 -33
  1379. data/spec/support/crypt/data_keys/key_document_gcp.json +0 -37
  1380. data/spec/support/crypt/data_keys/key_document_kmip.json +0 -32
  1381. data/spec/support/crypt/data_keys/key_document_local.json +0 -31
  1382. data/spec/support/crypt/encrypted_fields/encryptedFields.json +0 -32
  1383. data/spec/support/crypt/encrypted_fields/range-encryptedFields-Date.json +0 -30
  1384. data/spec/support/crypt/encrypted_fields/range-encryptedFields-DecimalNoPrecision.json +0 -21
  1385. data/spec/support/crypt/encrypted_fields/range-encryptedFields-DecimalPrecision.json +0 -29
  1386. data/spec/support/crypt/encrypted_fields/range-encryptedFields-DoubleNoPrecision.json +0 -21
  1387. data/spec/support/crypt/encrypted_fields/range-encryptedFields-DoublePrecision.json +0 -30
  1388. data/spec/support/crypt/encrypted_fields/range-encryptedFields-Int.json +0 -27
  1389. data/spec/support/crypt/encrypted_fields/range-encryptedFields-Long.json +0 -27
  1390. data/spec/support/crypt/external/external-key.json +0 -31
  1391. data/spec/support/crypt/external/external-schema.json +0 -19
  1392. data/spec/support/crypt/keys/key1-document.json +0 -30
  1393. data/spec/support/crypt/limits/limits-doc.json +0 -102
  1394. data/spec/support/crypt/limits/limits-key.json +0 -31
  1395. data/spec/support/crypt/limits/limits-schema.json +0 -1405
  1396. data/spec/support/crypt/schema_maps/schema_map_aws.json +0 -17
  1397. data/spec/support/crypt/schema_maps/schema_map_aws_key_alt_names.json +0 -12
  1398. data/spec/support/crypt/schema_maps/schema_map_azure.json +0 -17
  1399. data/spec/support/crypt/schema_maps/schema_map_azure_key_alt_names.json +0 -12
  1400. data/spec/support/crypt/schema_maps/schema_map_gcp.json +0 -17
  1401. data/spec/support/crypt/schema_maps/schema_map_gcp_key_alt_names.json +0 -12
  1402. data/spec/support/crypt/schema_maps/schema_map_kmip.json +0 -17
  1403. data/spec/support/crypt/schema_maps/schema_map_kmip_key_alt_names.json +0 -12
  1404. data/spec/support/crypt/schema_maps/schema_map_local.json +0 -18
  1405. data/spec/support/crypt/schema_maps/schema_map_local_key_alt_names.json +0 -12
  1406. data/spec/support/crypt.rb +0 -412
  1407. data/spec/support/dns.rb +0 -16
  1408. data/spec/support/json_ext_formatter.rb +0 -16
  1409. data/spec/support/keyword_struct.rb +0 -29
  1410. data/spec/support/local_resource_registry.rb +0 -37
  1411. data/spec/support/macros.rb +0 -29
  1412. data/spec/support/matchers.rb +0 -88
  1413. data/spec/support/mongos_macros.rb +0 -24
  1414. data/spec/support/monitoring_ext.rb +0 -19
  1415. data/spec/support/ocsp +0 -1
  1416. data/spec/support/primary_socket.rb +0 -24
  1417. data/spec/support/recording_logger.rb +0 -27
  1418. data/spec/support/sdam_formatter_integration.rb +0 -119
  1419. data/spec/support/shared/app_metadata.rb +0 -179
  1420. data/spec/support/shared/auth_context.rb +0 -17
  1421. data/spec/support/shared/protocol.rb +0 -36
  1422. data/spec/support/shared/scram_conversation.rb +0 -104
  1423. data/spec/support/shared/server_selector.rb +0 -233
  1424. data/spec/support/shared/session.rb +0 -916
  1425. data/spec/support/spec_config.rb +0 -767
  1426. data/spec/support/spec_setup.rb +0 -83
  1427. data/spec/support/using_hash.rb +0 -40
  1428. data/spec/support/utils.rb +0 -680
@@ -1,4472 +0,0 @@
1
- # frozen_string_literal: true
2
- # rubocop:todo all
3
-
4
- require 'spec_helper'
5
-
6
- describe Mongo::Collection do
7
- retry_test
8
-
9
- let(:subscriber) { Mrss::EventSubscriber.new }
10
-
11
- let(:client) do
12
- authorized_client.tap do |client|
13
- client.subscribe(Mongo::Monitoring::COMMAND, subscriber)
14
- end
15
- end
16
-
17
- let(:authorized_collection) { client['collection_spec'] }
18
-
19
- before do
20
- authorized_client['collection_spec'].drop
21
- end
22
-
23
- let(:collection_invalid_write_concern) do
24
- authorized_collection.client.with(write: INVALID_WRITE_CONCERN)[authorized_collection.name]
25
- end
26
-
27
- let(:collection_with_validator) do
28
- authorized_client[:validating]
29
- end
30
-
31
- describe '#find' do
32
-
33
- describe 'updating cluster time' do
34
-
35
- let(:operation) do
36
- client[TEST_COLL].find.first
37
- end
38
-
39
- let(:operation_with_session) do
40
- client[TEST_COLL].find({}, session: session).first
41
- end
42
-
43
- let(:second_operation) do
44
- client[TEST_COLL].find({}, session: session).first
45
- end
46
-
47
- it_behaves_like 'an operation updating cluster time'
48
- end
49
-
50
- context 'when provided a filter' do
51
-
52
- let(:view) do
53
- authorized_collection.find(name: 1)
54
- end
55
-
56
- it 'returns a authorized_collection view for the filter' do
57
- expect(view.filter).to eq('name' => 1)
58
- end
59
- end
60
-
61
- context 'when provided no filter' do
62
-
63
- let(:view) do
64
- authorized_collection.find
65
- end
66
-
67
- it 'returns a authorized_collection view with an empty filter' do
68
- expect(view.filter).to be_empty
69
- end
70
- end
71
-
72
- context 'when providing a bad filter' do
73
-
74
- let(:view) do
75
- authorized_collection.find('$or' => [])
76
- end
77
-
78
- it 'raises an exception when iterating' do
79
- expect {
80
- view.to_a
81
- }.to raise_exception(Mongo::Error::OperationFailure)
82
- end
83
- end
84
-
85
- context 'when iterating the authorized_collection view' do
86
-
87
- before do
88
- authorized_collection.insert_many([{ field: 'test1' }, { field: 'test2' }])
89
- end
90
-
91
- let(:view) do
92
- authorized_collection.find
93
- end
94
-
95
- it 'iterates over the documents' do
96
- view.each do |document|
97
- expect(document).to_not be_nil
98
- end
99
- end
100
- end
101
-
102
- context 'when the user is not authorized' do
103
- require_auth
104
-
105
- let(:view) do
106
- unauthorized_collection.find
107
- end
108
-
109
- it 'iterates over the documents' do
110
- expect {
111
- view.each{ |document| document }
112
- }.to raise_error(Mongo::Error::OperationFailure)
113
- end
114
- end
115
-
116
- context 'when documents contain potential error message fields' do
117
-
118
- [ 'errmsg', 'error', Mongo::Operation::Result::OK ].each do |field|
119
-
120
- context "when the document contains a '#{field}' field" do
121
-
122
- let(:value) do
123
- 'testing'
124
- end
125
-
126
- let(:view) do
127
- authorized_collection.find
128
- end
129
-
130
- before do
131
- authorized_collection.insert_one({ field => value })
132
- end
133
-
134
- it 'iterates over the documents' do
135
- view.each do |document|
136
- expect(document[field]).to eq(value)
137
- end
138
- end
139
- end
140
- end
141
- end
142
-
143
- context 'when provided options' do
144
-
145
- context 'when a session is provided' do
146
- require_wired_tiger
147
-
148
- let(:operation) do
149
- authorized_collection.find({}, session: session).to_a
150
- end
151
-
152
- let(:session) do
153
- authorized_client.start_session
154
- end
155
-
156
- let(:failed_operation) do
157
- client[authorized_collection.name].find({ '$._id' => 1 }, session: session).to_a
158
- end
159
-
160
- let(:client) do
161
- authorized_client
162
- end
163
-
164
- it_behaves_like 'an operation using a session'
165
- it_behaves_like 'a failed operation using a session'
166
- end
167
-
168
- context 'session id' do
169
- min_server_fcv '3.6'
170
- require_topology :replica_set, :sharded
171
- require_wired_tiger
172
-
173
- let(:options) do
174
- { session: session }
175
- end
176
-
177
- let(:session) do
178
- client.start_session
179
- end
180
-
181
- let(:view) do
182
- Mongo::Collection::View.new(client[TEST_COLL], selector, view_options)
183
- end
184
-
185
- let(:command) do
186
- client[TEST_COLL].find({}, session: session).explain
187
- subscriber.started_events.find { |c| c.command_name == 'explain' }.command
188
- end
189
-
190
- it 'sends the session id' do
191
- expect(command['lsid']).to eq(session.session_id)
192
- end
193
- end
194
-
195
- context 'when a session supporting causal consistency is used' do
196
- require_wired_tiger
197
-
198
- let(:operation) do
199
- collection.find({}, session: session).to_a
200
- end
201
-
202
- let(:command) do
203
- operation
204
- subscriber.started_events.find { |cmd| cmd.command_name == 'find' }.command
205
- end
206
-
207
- it_behaves_like 'an operation supporting causally consistent reads'
208
- end
209
-
210
- let(:view) do
211
- authorized_collection.find({}, options)
212
- end
213
-
214
- context 'when provided :allow_partial_results' do
215
-
216
- let(:options) do
217
- { allow_partial_results: true }
218
- end
219
-
220
- it 'returns a view with :allow_partial_results set' do
221
- expect(view.options[:allow_partial_results]).to be(options[:allow_partial_results])
222
- end
223
- end
224
-
225
- context 'when provided :batch_size' do
226
-
227
- let(:options) do
228
- { batch_size: 100 }
229
- end
230
-
231
- it 'returns a view with :batch_size set' do
232
- expect(view.options[:batch_size]).to eq(options[:batch_size])
233
- end
234
- end
235
-
236
- context 'when provided :comment' do
237
-
238
- let(:options) do
239
- { comment: 'slow query' }
240
- end
241
-
242
- it 'returns a view with :comment set' do
243
- expect(view.modifiers[:$comment]).to eq(options[:comment])
244
- end
245
- end
246
-
247
- context 'when provided :cursor_type' do
248
-
249
- let(:options) do
250
- { cursor_type: :tailable }
251
- end
252
-
253
- it 'returns a view with :cursor_type set' do
254
- expect(view.options[:cursor_type]).to eq(options[:cursor_type])
255
- end
256
- end
257
-
258
- context 'when provided :max_time_ms' do
259
-
260
- let(:options) do
261
- { max_time_ms: 500 }
262
- end
263
-
264
- it 'returns a view with :max_time_ms set' do
265
- expect(view.modifiers[:$maxTimeMS]).to eq(options[:max_time_ms])
266
- end
267
- end
268
-
269
- context 'when provided :modifiers' do
270
-
271
- let(:options) do
272
- { modifiers: { '$orderby' => Mongo::Index::ASCENDING } }
273
- end
274
-
275
- it 'returns a view with modifiers set' do
276
- expect(view.modifiers).to eq(options[:modifiers])
277
- end
278
-
279
- it 'dups the modifiers hash' do
280
- expect(view.modifiers).not_to be(options[:modifiers])
281
- end
282
- end
283
-
284
- context 'when provided :no_cursor_timeout' do
285
-
286
- let(:options) do
287
- { no_cursor_timeout: true }
288
- end
289
-
290
- it 'returns a view with :no_cursor_timeout set' do
291
- expect(view.options[:no_cursor_timeout]).to eq(options[:no_cursor_timeout])
292
- end
293
- end
294
-
295
- context 'when provided :oplog_replay' do
296
-
297
- let(:options) do
298
- { oplog_replay: false }
299
- end
300
-
301
- it 'returns a view with :oplog_replay set' do
302
- expect(view.options[:oplog_replay]).to eq(options[:oplog_replay])
303
- end
304
- end
305
-
306
- context 'when provided :projection' do
307
-
308
- let(:options) do
309
- { projection: { 'x' => 1 } }
310
- end
311
-
312
- it 'returns a view with :projection set' do
313
- expect(view.options[:projection]).to eq(options[:projection])
314
- end
315
- end
316
-
317
- context 'when provided :skip' do
318
-
319
- let(:options) do
320
- { skip: 5 }
321
- end
322
-
323
- it 'returns a view with :skip set' do
324
- expect(view.options[:skip]).to eq(options[:skip])
325
- end
326
- end
327
-
328
- context 'when provided :sort' do
329
-
330
- let(:options) do
331
- { sort: { 'x' => Mongo::Index::ASCENDING } }
332
- end
333
-
334
- it 'returns a view with :sort set' do
335
- expect(view.modifiers[:$orderby]).to eq(options[:sort])
336
- end
337
- end
338
-
339
- context 'when provided :collation' do
340
-
341
- let(:options) do
342
- { collation: { 'locale' => 'en_US' } }
343
- end
344
-
345
- it 'returns a view with :collation set' do
346
- expect(view.options[:collation]).to eq(options[:collation])
347
- end
348
- end
349
- end
350
- end
351
-
352
- describe '#insert_many' do
353
-
354
- let(:result) do
355
- authorized_collection.insert_many([{ name: 'test1' }, { name: 'test2' }])
356
- end
357
-
358
- it 'inserts the documents into the collection' do
359
- expect(result.inserted_count).to eq(2)
360
- end
361
-
362
- it 'contains the ids in the result' do
363
- expect(result.inserted_ids.size).to eq(2)
364
- end
365
-
366
- context 'when an enumerable is used instead of an array' do
367
-
368
- context 'when the enumerable is not empty' do
369
-
370
- let(:source_data) do
371
- [{ name: 'test1' }, { name: 'test2' }]
372
- end
373
-
374
- let(:result) do
375
- authorized_collection.insert_many(source_data.lazy)
376
- end
377
-
378
- it 'should accepts them without raising an error' do
379
- expect { result }.to_not raise_error
380
- expect(result.inserted_count).to eq(source_data.size)
381
- end
382
- end
383
-
384
- context 'when the enumerable is empty' do
385
-
386
- let(:source_data) do
387
- []
388
- end
389
-
390
- let(:result) do
391
- authorized_collection.insert_many(source_data.lazy)
392
- end
393
-
394
- it 'should raise ArgumentError' do
395
- expect do
396
- result
397
- end.to raise_error(ArgumentError, /Bulk write requests cannot be empty/)
398
- end
399
- end
400
- end
401
-
402
- context 'when a session is provided' do
403
-
404
- let(:session) do
405
- authorized_client.start_session
406
- end
407
-
408
- let(:operation) do
409
- authorized_collection.insert_many([{ name: 'test1' }, { name: 'test2' }], session: session)
410
- end
411
-
412
- let(:failed_operation) do
413
- authorized_collection.insert_many([{ _id: 'test1' }, { _id: 'test1' }], session: session)
414
- end
415
-
416
- let(:client) do
417
- authorized_client
418
- end
419
-
420
- it_behaves_like 'an operation using a session'
421
- it_behaves_like 'a failed operation using a session'
422
- end
423
-
424
- context 'when unacknowledged writes is used with an explicit session' do
425
-
426
- let(:collection_with_unacknowledged_write_concern) do
427
- authorized_collection.with(write: { w: 0 })
428
- end
429
-
430
- let(:operation) do
431
- collection_with_unacknowledged_write_concern.insert_many([{ name: 'test1' }, { name: 'test2' }], session: session)
432
- end
433
-
434
- it_behaves_like 'an explicit session with an unacknowledged write'
435
- end
436
-
437
- context 'when unacknowledged writes is used with an implicit session' do
438
-
439
- let(:collection_with_unacknowledged_write_concern) do
440
- client.with(write: { w: 0 })[TEST_COLL]
441
- end
442
-
443
- let(:operation) do
444
- collection_with_unacknowledged_write_concern.insert_many([{ name: 'test1' }, { name: 'test2' }])
445
- end
446
-
447
- it_behaves_like 'an implicit session with an unacknowledged write'
448
- end
449
-
450
- context 'when a document contains dotted keys' do
451
-
452
- let(:docs) do
453
- [ { 'first.name' => 'test1' }, { name: 'test2' } ]
454
- end
455
-
456
- let(:view) { authorized_collection.find({}, { sort: { name: 1 } }) }
457
-
458
- it 'inserts the documents correctly' do
459
- expect {
460
- authorized_collection.insert_many(docs)
461
- }.to_not raise_error
462
-
463
- expect(view.count).to eq(2)
464
- expect(view.first['first.name']).to eq('test1')
465
- expect(view.to_a[1]['name']).to eq('test2')
466
- end
467
- end
468
-
469
- context 'when the client has a custom id generator' do
470
-
471
- let(:generator) do
472
- Class.new do
473
- def generate
474
- 1
475
- end
476
- end.new
477
- end
478
-
479
- let(:custom_client) do
480
- authorized_client.with(id_generator: generator)
481
- end
482
-
483
- let(:custom_collection) do
484
- custom_client['custom_id_generator_test_collection']
485
- end
486
-
487
- before do
488
- custom_collection.delete_many
489
- custom_collection.insert_many([{ name: 'testing' }])
490
- expect(custom_collection.count).to eq(1)
491
- end
492
-
493
- it 'inserts with the custom id' do
494
- expect(custom_collection.count).to eq(1)
495
- expect(custom_collection.find.first[:_id]).to eq(1)
496
- end
497
- end
498
-
499
- context 'when the inserts fail' do
500
-
501
- let(:result) do
502
- authorized_collection.insert_many([{ _id: 1 }, { _id: 1 }])
503
- end
504
-
505
- it 'raises an BulkWriteError' do
506
- expect {
507
- result
508
- }.to raise_exception(Mongo::Error::BulkWriteError)
509
- end
510
- end
511
-
512
- context "when the documents exceed the max bson size" do
513
-
514
- let(:documents) do
515
- [{ '_id' => 1, 'name' => '1'*17000000 }]
516
- end
517
-
518
- it 'raises a MaxBSONSize error' do
519
- expect {
520
- authorized_collection.insert_many(documents)
521
- }.to raise_error(Mongo::Error::MaxBSONSize)
522
- end
523
- end
524
-
525
- context 'when the documents are sent with OP_MSG' do
526
- min_server_fcv '3.6'
527
-
528
- let(:documents) do
529
- [{ '_id' => 1, 'name' => '1'*16777191 }, { '_id' => 'y' }]
530
- end
531
-
532
- before do
533
- authorized_collection.insert_many(documents)
534
- end
535
-
536
- let(:insert_events) do
537
- subscriber.started_events.select { |e| e.command_name == 'insert' }
538
- end
539
-
540
- it 'sends the documents in one OP_MSG' do
541
- expect(insert_events.size).to eq(1)
542
- expect(insert_events[0].command['documents']).to eq(documents)
543
- end
544
- end
545
-
546
- context 'when collection has a validator' do
547
- min_server_fcv '3.2'
548
-
549
- around(:each) do |spec|
550
- authorized_client[:validating].drop
551
- authorized_client[:validating,
552
- :validator => { :a => { '$exists' => true } }].tap do |c|
553
- c.create
554
- end
555
- spec.run
556
- collection_with_validator.drop
557
- end
558
-
559
- context 'when the document is valid' do
560
-
561
- let(:result) do
562
- collection_with_validator.insert_many([{ a: 1 }, { a: 2 }])
563
- end
564
-
565
- it 'inserts successfully' do
566
- expect(result.inserted_count).to eq(2)
567
- end
568
- end
569
-
570
- context 'when the document is invalid' do
571
-
572
- context 'when bypass_document_validation is not set' do
573
-
574
- let(:result2) do
575
- collection_with_validator.insert_many([{ x: 1 }, { x: 2 }])
576
- end
577
-
578
- it 'raises a BulkWriteError' do
579
- expect {
580
- result2
581
- }.to raise_exception(Mongo::Error::BulkWriteError)
582
- end
583
- end
584
-
585
- context 'when bypass_document_validation is true' do
586
-
587
- let(:result3) do
588
- collection_with_validator.insert_many(
589
- [{ x: 1 }, { x: 2 }], :bypass_document_validation => true)
590
- end
591
-
592
- it 'inserts successfully' do
593
- expect(result3.inserted_count).to eq(2)
594
- end
595
- end
596
- end
597
- end
598
-
599
- context 'when unacknowledged writes is used' do
600
-
601
- let(:collection_with_unacknowledged_write_concern) do
602
- authorized_collection.with(write: { w: 0 })
603
- end
604
-
605
- let(:result) do
606
- collection_with_unacknowledged_write_concern.insert_many([{ _id: 1 }, { _id: 1 }])
607
- end
608
-
609
- it 'does not raise an exception' do
610
- expect(result.inserted_count).to be(0)
611
- end
612
- end
613
-
614
- context 'when various options passed in' do
615
- # w: 2 requires a replica set
616
- require_topology :replica_set
617
-
618
- # https://jira.mongodb.org/browse/RUBY-2306
619
- min_server_fcv '3.6'
620
-
621
- let(:session) do
622
- authorized_client.start_session
623
- end
624
-
625
- let(:events) do
626
- subscriber.command_started_events('insert')
627
- end
628
-
629
- let(:collection) do
630
- authorized_collection.with(write_concern: {w: 2})
631
- end
632
-
633
- let!(:command) do
634
- Utils.get_command_event(authorized_client, 'insert') do |client|
635
- collection.insert_many([{ name: 'test1' }, { name: 'test2' }], session: session,
636
- write_concern: {w: 1}, bypass_document_validation: true)
637
- end.command
638
- end
639
-
640
- it 'inserts many successfully with correct options sent to server' do
641
- expect(events.length).to eq(1)
642
- expect(command[:writeConcern]).to_not be_nil
643
- expect(command[:writeConcern][:w]).to eq(1)
644
- expect(command[:bypassDocumentValidation]).to be(true)
645
- end
646
- end
647
- end
648
-
649
- describe '#insert_one' do
650
-
651
- describe 'updating cluster time' do
652
-
653
- let(:operation) do
654
- client[TEST_COLL].insert_one({ name: 'testing' })
655
- end
656
-
657
- let(:operation_with_session) do
658
- client[TEST_COLL].insert_one({ name: 'testing' }, session: session)
659
- end
660
-
661
- let(:second_operation) do
662
- client[TEST_COLL].insert_one({ name: 'testing' }, session: session)
663
- end
664
-
665
- it_behaves_like 'an operation updating cluster time'
666
- end
667
-
668
- let(:result) do
669
- authorized_collection.insert_one({ name: 'testing' })
670
- end
671
-
672
- it 'inserts the document into the collection'do
673
- expect(result.written_count).to eq(1)
674
- end
675
-
676
- it 'contains the id in the result' do
677
- expect(result.inserted_id).to_not be_nil
678
- end
679
-
680
- context 'when a session is provided' do
681
-
682
- let(:session) do
683
- authorized_client.start_session
684
- end
685
-
686
- let(:operation) do
687
- authorized_collection.insert_one({ name: 'testing' }, session: session)
688
- end
689
-
690
- let(:failed_operation) do
691
- authorized_collection.insert_one({ _id: 'testing' })
692
- authorized_collection.insert_one({ _id: 'testing' }, session: session)
693
- end
694
-
695
- let(:client) do
696
- authorized_client
697
- end
698
-
699
- it_behaves_like 'an operation using a session'
700
- it_behaves_like 'a failed operation using a session'
701
- end
702
-
703
- context 'when unacknowledged writes is used with an explicit session' do
704
-
705
- let(:collection_with_unacknowledged_write_concern) do
706
- authorized_collection.with(write: { w: 0 })
707
- end
708
-
709
- let(:operation) do
710
- collection_with_unacknowledged_write_concern.insert_one({ name: 'testing' }, session: session)
711
- end
712
-
713
- it_behaves_like 'an explicit session with an unacknowledged write'
714
- end
715
-
716
- context 'when unacknowledged writes is used with an implicit session' do
717
-
718
- let(:collection_with_unacknowledged_write_concern) do
719
- client.with(write: { w: 0 })[TEST_COLL]
720
- end
721
-
722
- let(:operation) do
723
- collection_with_unacknowledged_write_concern.insert_one({ name: 'testing' })
724
- end
725
-
726
- it_behaves_like 'an implicit session with an unacknowledged write'
727
- end
728
-
729
- context 'when various options passed in' do
730
- # https://jira.mongodb.org/browse/RUBY-2306
731
- min_server_fcv '3.6'
732
-
733
- let(:session) do
734
- authorized_client.start_session
735
- end
736
-
737
- let(:events) do
738
- subscriber.command_started_events('insert')
739
- end
740
-
741
- let(:collection) do
742
- authorized_collection.with(write_concern: {w: 3})
743
- end
744
-
745
- let!(:command) do
746
- Utils.get_command_event(authorized_client, 'insert') do |client|
747
- collection.insert_one({name: 'test1'}, session: session, write_concern: {w: 1},
748
- bypass_document_validation: true)
749
- end.command
750
- end
751
-
752
- it 'inserts one successfully with correct options sent to server' do
753
- expect(events.length).to eq(1)
754
- expect(command[:writeConcern]).to_not be_nil
755
- expect(command[:writeConcern][:w]).to eq(1)
756
- expect(command[:bypassDocumentValidation]).to be(true)
757
- end
758
- end
759
-
760
- context 'when the document contains dotted keys' do
761
-
762
- let(:doc) do
763
- { 'testing.test' => 'value' }
764
- end
765
-
766
- it 'inserts the document correctly' do
767
- expect {
768
- authorized_collection.insert_one(doc)
769
- }.to_not raise_error
770
-
771
- expect(authorized_collection.count).to eq(1)
772
- expect(authorized_collection.find.first['testing.test']).to eq('value')
773
- end
774
- end
775
-
776
- context 'when the document is nil' do
777
- let(:result) do
778
- authorized_collection.insert_one(nil)
779
- end
780
-
781
- it 'raises an ArgumentError' do
782
- expect {
783
- result
784
- }.to raise_error(ArgumentError, "Document to be inserted cannot be nil")
785
- end
786
- end
787
-
788
- context 'when the insert fails' do
789
-
790
- let(:result) do
791
- authorized_collection.insert_one(_id: 1)
792
- authorized_collection.insert_one(_id: 1)
793
- end
794
-
795
- it 'raises an OperationFailure' do
796
- expect {
797
- result
798
- }.to raise_exception(Mongo::Error::OperationFailure)
799
- end
800
- end
801
-
802
- context 'when the client has a custom id generator' do
803
-
804
- let(:generator) do
805
- Class.new do
806
- def generate
807
- 1
808
- end
809
- end.new
810
- end
811
-
812
- let(:custom_client) do
813
- authorized_client.with(id_generator: generator)
814
- end
815
-
816
- let(:custom_collection) do
817
- custom_client[TEST_COLL]
818
- end
819
-
820
- before do
821
- custom_collection.delete_many
822
- custom_collection.insert_one({ name: 'testing' })
823
- end
824
-
825
- it 'inserts with the custom id' do
826
- expect(custom_collection.find.first[:_id]).to eq(1)
827
- end
828
- end
829
-
830
- context 'when collection has a validator' do
831
- min_server_fcv '3.2'
832
-
833
- around(:each) do |spec|
834
- authorized_client[:validating,
835
- :validator => { :a => { '$exists' => true } }].tap do |c|
836
- c.create
837
- end
838
- spec.run
839
- collection_with_validator.drop
840
- end
841
-
842
- context 'when the document is valid' do
843
-
844
- let(:result) do
845
- collection_with_validator.insert_one({ a: 1 })
846
- end
847
-
848
- it 'inserts successfully' do
849
- expect(result.written_count).to eq(1)
850
- end
851
- end
852
-
853
- context 'when the document is invalid' do
854
-
855
- context 'when bypass_document_validation is not set' do
856
-
857
- let(:result2) do
858
- collection_with_validator.insert_one({ x: 1 })
859
- end
860
-
861
- it 'raises a OperationFailure' do
862
- expect {
863
- result2
864
- }.to raise_exception(Mongo::Error::OperationFailure)
865
- end
866
- end
867
-
868
- context 'when bypass_document_validation is true' do
869
-
870
- let(:result3) do
871
- collection_with_validator.insert_one(
872
- { x: 1 }, :bypass_document_validation => true)
873
- end
874
-
875
- it 'inserts successfully' do
876
- expect(result3.written_count).to eq(1)
877
- end
878
- end
879
- end
880
- end
881
- end
882
-
883
- describe '#bulk_write' do
884
-
885
- context 'when various options passed in' do
886
- min_server_fcv '3.2'
887
- require_topology :replica_set
888
-
889
- # https://jira.mongodb.org/browse/RUBY-2306
890
- min_server_fcv '3.6'
891
-
892
- let(:requests) do
893
- [
894
- { insert_one: { name: "anne" }},
895
- { insert_one: { name: "bob" }},
896
- { insert_one: { name: "charlie" }}
897
- ]
898
- end
899
-
900
- let(:session) do
901
- authorized_client.start_session
902
- end
903
-
904
- let!(:command) do
905
- Utils.get_command_event(authorized_client, 'insert') do |client|
906
- collection.bulk_write(requests, session: session, write_concern: {w: 1},
907
- bypass_document_validation: true)
908
- end.command
909
- end
910
-
911
- let(:events) do
912
- subscriber.command_started_events('insert')
913
- end
914
-
915
- let(:collection) do
916
- authorized_collection.with(write_concern: {w: 2})
917
- end
918
-
919
- it 'inserts successfully with correct options sent to server' do
920
- expect(collection.count).to eq(3)
921
- expect(events.length).to eq(1)
922
- expect(command[:writeConcern]).to_not be_nil
923
- expect(command[:writeConcern][:w]).to eq(1)
924
- expect(command[:bypassDocumentValidation]).to eq(true)
925
- end
926
- end
927
- end
928
-
929
- describe '#aggregate' do
930
-
931
- describe 'updating cluster time' do
932
-
933
- let(:operation) do
934
- client[TEST_COLL].aggregate([]).first
935
- end
936
-
937
- let(:operation_with_session) do
938
- client[TEST_COLL].aggregate([], session: session).first
939
- end
940
-
941
- let(:second_operation) do
942
- client[TEST_COLL].aggregate([], session: session).first
943
- end
944
-
945
- it_behaves_like 'an operation updating cluster time'
946
- end
947
-
948
- context 'when a session supporting causal consistency is used' do
949
- require_wired_tiger
950
-
951
- let(:operation) do
952
- collection.aggregate([], session: session).first
953
- end
954
-
955
- let(:command) do
956
- operation
957
- subscriber.started_events.find { |cmd| cmd.command_name == 'aggregate' }.command
958
- end
959
-
960
- it_behaves_like 'an operation supporting causally consistent reads'
961
- end
962
-
963
- it 'returns an Aggregation object' do
964
- expect(authorized_collection.aggregate([])).to be_a(Mongo::Collection::View::Aggregation)
965
- end
966
-
967
- context 'when options are provided' do
968
-
969
- let(:options) do
970
- { :allow_disk_use => true, :bypass_document_validation => true }
971
- end
972
-
973
- it 'sets the options on the Aggregation object' do
974
- expect(authorized_collection.aggregate([], options).options).to eq(BSON::Document.new(options))
975
- end
976
-
977
- context 'when the :comment option is provided' do
978
-
979
- let(:options) do
980
- { :comment => 'testing' }
981
- end
982
-
983
- it 'sets the options on the Aggregation object' do
984
- expect(authorized_collection.aggregate([], options).options).to eq(BSON::Document.new(options))
985
- end
986
- end
987
-
988
- context 'when a session is provided' do
989
-
990
- let(:session) do
991
- authorized_client.start_session
992
- end
993
-
994
- let(:operation) do
995
- authorized_collection.aggregate([], session: session).to_a
996
- end
997
-
998
- let(:failed_operation) do
999
- authorized_collection.aggregate([ { '$invalid' => 1 }], session: session).to_a
1000
- end
1001
-
1002
- let(:client) do
1003
- authorized_client
1004
- end
1005
-
1006
- it_behaves_like 'an operation using a session'
1007
- it_behaves_like 'a failed operation using a session'
1008
- end
1009
-
1010
- context 'when a hint is provided' do
1011
-
1012
- let(:options) do
1013
- { 'hint' => { 'y' => 1 } }
1014
- end
1015
-
1016
- it 'sets the options on the Aggregation object' do
1017
- expect(authorized_collection.aggregate([], options).options).to eq(options)
1018
- end
1019
- end
1020
-
1021
- context 'when collation is provided' do
1022
-
1023
- before do
1024
- authorized_collection.insert_many([ { name: 'bang' }, { name: 'bang' }])
1025
- end
1026
-
1027
- let(:pipeline) do
1028
- [{ "$match" => { "name" => "BANG" } }]
1029
- end
1030
-
1031
- let(:options) do
1032
- { collation: { locale: 'en_US', strength: 2 } }
1033
- end
1034
-
1035
- let(:result) do
1036
- authorized_collection.aggregate(pipeline, options).collect { |doc| doc['name']}
1037
- end
1038
-
1039
- context 'when the server selected supports collations' do
1040
- min_server_fcv '3.4'
1041
-
1042
- it 'applies the collation' do
1043
- expect(result).to eq(['bang', 'bang'])
1044
- end
1045
- end
1046
-
1047
- context 'when the server selected does not support collations' do
1048
- max_server_version '3.2'
1049
-
1050
- it 'raises an exception' do
1051
- expect {
1052
- result
1053
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
1054
- end
1055
-
1056
- context 'when a String key is used' do
1057
-
1058
- let(:options) do
1059
- { 'collation' => { locale: 'en_US', strength: 2 } }
1060
- end
1061
-
1062
- it 'raises an exception' do
1063
- expect {
1064
- result
1065
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
1066
- end
1067
- end
1068
- end
1069
- end
1070
- end
1071
- end
1072
-
1073
- describe '#count_documents' do
1074
-
1075
- before do
1076
- authorized_collection.delete_many
1077
- end
1078
-
1079
- context 'no argument provided' do
1080
-
1081
- context 'when collection is empty' do
1082
- it 'returns 0 matching documents' do
1083
- expect(authorized_collection.count_documents).to eq(0)
1084
- end
1085
- end
1086
-
1087
- context 'when collection is not empty' do
1088
-
1089
- let(:documents) do
1090
- documents = []
1091
- 1.upto(10) do |index|
1092
- documents << { key: 'a', _id: "in#{index}" }
1093
- end
1094
- documents
1095
- end
1096
-
1097
- before do
1098
- authorized_collection.insert_many(documents)
1099
- end
1100
-
1101
- it 'returns 10 matching documents' do
1102
- expect(authorized_collection.count_documents).to eq(10)
1103
- end
1104
- end
1105
- end
1106
-
1107
- context 'when transactions are enabled' do
1108
- require_wired_tiger
1109
- require_transaction_support
1110
-
1111
- before do
1112
- # Ensure that the collection is created
1113
- authorized_collection.insert_one(x: 1)
1114
- authorized_collection.delete_many({})
1115
- end
1116
-
1117
- let(:session) do
1118
- authorized_client.start_session
1119
- end
1120
-
1121
- it 'successfully starts a transaction and executes a transaction' do
1122
- session.start_transaction
1123
- expect(
1124
- session.instance_variable_get(:@state)
1125
- ).to eq(Mongo::Session::STARTING_TRANSACTION_STATE)
1126
-
1127
- expect(authorized_collection.count_documents({}, { session: session })).to eq(0)
1128
- expect(
1129
- session.instance_variable_get(:@state)
1130
- ).to eq(Mongo::Session::TRANSACTION_IN_PROGRESS_STATE)
1131
-
1132
- authorized_collection.insert_one({ x: 1 }, { session: session })
1133
- expect(authorized_collection.count_documents({}, { session: session })).to eq(1)
1134
-
1135
- session.commit_transaction
1136
- expect(
1137
- session.instance_variable_get(:@state)
1138
- ).to eq(Mongo::Session::TRANSACTION_COMMITTED_STATE)
1139
- end
1140
- end
1141
- end
1142
-
1143
- describe '#count' do
1144
-
1145
- let(:documents) do
1146
- (1..10).map{ |i| { field: "test#{i}" }}
1147
- end
1148
-
1149
- before do
1150
- authorized_collection.insert_many(documents)
1151
- end
1152
-
1153
- it 'returns an integer count' do
1154
- expect(authorized_collection.count).to eq(10)
1155
- end
1156
-
1157
- context 'when options are provided' do
1158
-
1159
- it 'passes the options to the count' do
1160
- expect(authorized_collection.count({}, limit: 5)).to eq(5)
1161
- end
1162
-
1163
- context 'when a session is provided' do
1164
- require_wired_tiger
1165
-
1166
- let(:session) do
1167
- authorized_client.start_session
1168
- end
1169
-
1170
- let(:operation) do
1171
- authorized_collection.count({}, session: session)
1172
- end
1173
-
1174
- let(:failed_operation) do
1175
- authorized_collection.count({ '$._id' => 1 }, session: session)
1176
- end
1177
-
1178
- let(:client) do
1179
- authorized_client
1180
- end
1181
-
1182
- it_behaves_like 'an operation using a session'
1183
- it_behaves_like 'a failed operation using a session'
1184
- end
1185
-
1186
- context 'when a session supporting causal consistency is used' do
1187
- require_wired_tiger
1188
-
1189
- let(:operation) do
1190
- collection.count({}, session: session)
1191
- end
1192
-
1193
- let(:command) do
1194
- operation
1195
- subscriber.started_events.find { |cmd| cmd.command_name == 'count' }.command
1196
- end
1197
-
1198
- it_behaves_like 'an operation supporting causally consistent reads'
1199
- end
1200
-
1201
- context 'when a collation is specified' do
1202
-
1203
- let(:selector) do
1204
- { name: 'BANG' }
1205
- end
1206
-
1207
- let(:result) do
1208
- authorized_collection.count(selector, options)
1209
- end
1210
-
1211
- before do
1212
- authorized_collection.insert_one(name: 'bang')
1213
- end
1214
-
1215
- let(:options) do
1216
- { collation: { locale: 'en_US', strength: 2 } }
1217
- end
1218
-
1219
- context 'when the server selected supports collations' do
1220
- min_server_fcv '3.4'
1221
-
1222
- it 'applies the collation to the count' do
1223
- expect(result).to eq(1)
1224
- end
1225
- end
1226
-
1227
- context 'when the server selected does not support collations' do
1228
- max_server_version '3.2'
1229
-
1230
- it 'raises an exception' do
1231
- expect {
1232
- result
1233
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
1234
- end
1235
-
1236
- context 'when a String key is used' do
1237
-
1238
- let(:options) do
1239
- { 'collation' => { locale: 'en_US', strength: 2 } }
1240
- end
1241
-
1242
- it 'raises an exception' do
1243
- expect {
1244
- result
1245
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
1246
- end
1247
- end
1248
- end
1249
- end
1250
- end
1251
- end
1252
-
1253
- describe '#distinct' do
1254
-
1255
- let(:documents) do
1256
- (1..3).map{ |i| { field: "test#{i}" }}
1257
- end
1258
-
1259
- before do
1260
- authorized_collection.insert_many(documents)
1261
- end
1262
-
1263
- it 'returns the distinct values' do
1264
- expect(authorized_collection.distinct(:field).sort).to eq([ 'test1', 'test2', 'test3' ])
1265
- end
1266
-
1267
- context 'when a selector is provided' do
1268
-
1269
- it 'returns the distinct values' do
1270
- expect(authorized_collection.distinct(:field, field: 'test1')).to eq([ 'test1' ])
1271
- end
1272
- end
1273
-
1274
- context 'when options are provided' do
1275
-
1276
- it 'passes the options to the distinct command' do
1277
- expect(authorized_collection.distinct(:field, {}, max_time_ms: 100).sort).to eq([ 'test1', 'test2', 'test3' ])
1278
- end
1279
-
1280
- context 'when a session is provided' do
1281
- require_wired_tiger
1282
-
1283
- let(:session) do
1284
- authorized_client.start_session
1285
- end
1286
-
1287
- let(:operation) do
1288
- authorized_collection.distinct(:field, {}, session: session)
1289
- end
1290
-
1291
- let(:failed_operation) do
1292
- authorized_collection.distinct(:field, { '$._id' => 1 }, session: session)
1293
- end
1294
-
1295
- let(:client) do
1296
- authorized_client
1297
- end
1298
-
1299
- it_behaves_like 'an operation using a session'
1300
- it_behaves_like 'a failed operation using a session'
1301
- end
1302
- end
1303
-
1304
- context 'when a session supporting causal consistency is used' do
1305
- require_wired_tiger
1306
-
1307
- let(:operation) do
1308
- collection.distinct(:field, {}, session: session)
1309
- end
1310
-
1311
- let(:command) do
1312
- operation
1313
- subscriber.started_events.find { |cmd| cmd.command_name == 'distinct' }.command
1314
- end
1315
-
1316
- it_behaves_like 'an operation supporting causally consistent reads'
1317
- end
1318
-
1319
- context 'when a collation is specified' do
1320
-
1321
- let(:result) do
1322
- authorized_collection.distinct(:name, {}, options)
1323
- end
1324
-
1325
- before do
1326
- authorized_collection.insert_one(name: 'bang')
1327
- authorized_collection.insert_one(name: 'BANG')
1328
- end
1329
-
1330
- let(:options) do
1331
- { collation: { locale: 'en_US', strength: 2 } }
1332
- end
1333
-
1334
- context 'when the server selected supports collations' do
1335
- min_server_fcv '3.4'
1336
-
1337
- it 'applies the collation to the distinct' do
1338
- expect(result).to eq(['bang'])
1339
- end
1340
- end
1341
-
1342
- context 'when the server selected does not support collations' do
1343
- max_server_version '3.2'
1344
-
1345
- it 'raises an exception' do
1346
- expect {
1347
- result
1348
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
1349
- end
1350
-
1351
- context 'when a String key is used' do
1352
-
1353
- let(:options) do
1354
- { 'collation' => { locale: 'en_US', strength: 2 } }
1355
- end
1356
-
1357
- it 'raises an exception' do
1358
- expect {
1359
- result
1360
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
1361
- end
1362
- end
1363
- end
1364
- end
1365
-
1366
- context 'when a collation is not specified' do
1367
-
1368
- let(:result) do
1369
- authorized_collection.distinct(:name)
1370
- end
1371
-
1372
- before do
1373
- authorized_collection.insert_one(name: 'bang')
1374
- authorized_collection.insert_one(name: 'BANG')
1375
- end
1376
-
1377
- it 'does not apply the collation to the distinct' do
1378
- expect(result).to match_array(['bang', 'BANG'])
1379
- end
1380
- end
1381
- end
1382
-
1383
- describe '#delete_one' do
1384
-
1385
- context 'when a selector was provided' do
1386
-
1387
- let(:selector) do
1388
- { field: 'test1' }
1389
- end
1390
-
1391
- before do
1392
- authorized_collection.insert_many([
1393
- { field: 'test1' },
1394
- { field: 'test1' },
1395
- { field: 'test1' }
1396
- ])
1397
- end
1398
-
1399
- let(:response) do
1400
- authorized_collection.delete_one(selector)
1401
- end
1402
-
1403
- it 'deletes the first matching document in the collection' do
1404
- expect(response.deleted_count).to eq(1)
1405
- end
1406
- end
1407
-
1408
- context 'when no selector was provided' do
1409
-
1410
- before do
1411
- authorized_collection.insert_many([{ field: 'test1' }, { field: 'test2' }])
1412
- end
1413
-
1414
- let(:response) do
1415
- authorized_collection.delete_one
1416
- end
1417
-
1418
- it 'deletes the first document in the collection' do
1419
- expect(response.deleted_count).to eq(1)
1420
- end
1421
- end
1422
-
1423
- context 'when the delete fails' do
1424
- require_topology :single
1425
-
1426
- let(:result) do
1427
- collection_invalid_write_concern.delete_one
1428
- end
1429
-
1430
- it 'raises an OperationFailure' do
1431
- expect {
1432
- result
1433
- }.to raise_exception(Mongo::Error::OperationFailure)
1434
- end
1435
- end
1436
-
1437
- context 'when a session is provided' do
1438
-
1439
- let(:session) do
1440
- authorized_client.start_session
1441
- end
1442
-
1443
- let(:operation) do
1444
- authorized_collection.delete_one({}, session: session)
1445
- end
1446
-
1447
- let(:failed_operation) do
1448
- authorized_collection.delete_one({ '$._id' => 1}, session: session)
1449
- end
1450
-
1451
- let(:client) do
1452
- authorized_client
1453
- end
1454
-
1455
- it_behaves_like 'an operation using a session'
1456
- it_behaves_like 'a failed operation using a session'
1457
- end
1458
-
1459
- context 'when unacknowledged writes is used' do
1460
-
1461
- let(:collection_with_unacknowledged_write_concern) do
1462
- authorized_collection.with(write: { w: 0 })
1463
- end
1464
-
1465
- let(:operation) do
1466
- collection_with_unacknowledged_write_concern.delete_one({}, session: session)
1467
- end
1468
-
1469
- it_behaves_like 'an explicit session with an unacknowledged write'
1470
- end
1471
-
1472
- context 'when unacknowledged writes is used with an implicit session' do
1473
-
1474
- let(:collection_with_unacknowledged_write_concern) do
1475
- client.with(write: { w: 0 })[TEST_COLL]
1476
- end
1477
-
1478
- let(:operation) do
1479
- collection_with_unacknowledged_write_concern.delete_one
1480
- end
1481
-
1482
- it_behaves_like 'an implicit session with an unacknowledged write'
1483
- end
1484
-
1485
- context 'when a collation is provided' do
1486
-
1487
- let(:selector) do
1488
- { name: 'BANG' }
1489
- end
1490
-
1491
- let(:result) do
1492
- authorized_collection.delete_one(selector, options)
1493
- end
1494
-
1495
- before do
1496
- authorized_collection.insert_one(name: 'bang')
1497
- end
1498
-
1499
- let(:options) do
1500
- { collation: { locale: 'en_US', strength: 2 } }
1501
- end
1502
-
1503
- context 'when the server selected supports collations' do
1504
- min_server_fcv '3.4'
1505
-
1506
- it 'applies the collation' do
1507
- expect(result.written_count).to eq(1)
1508
- expect(authorized_collection.find(name: 'bang').count).to eq(0)
1509
- end
1510
-
1511
- context 'when unacknowledged writes is used' do
1512
-
1513
- let(:collection_with_unacknowledged_write_concern) do
1514
- authorized_collection.with(write: { w: 0 })
1515
- end
1516
-
1517
- let(:result) do
1518
- collection_with_unacknowledged_write_concern.delete_one(selector, options)
1519
- end
1520
-
1521
- it 'raises an exception' do
1522
- expect {
1523
- result
1524
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
1525
- end
1526
-
1527
- context 'when a String key is used' do
1528
-
1529
- let(:options) do
1530
- { 'collation' => { locale: 'en_US', strength: 2 } }
1531
- end
1532
-
1533
- it 'raises an exception' do
1534
- expect {
1535
- result
1536
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
1537
- end
1538
- end
1539
- end
1540
- end
1541
-
1542
- context 'when the server selected does not support collations' do
1543
- max_server_version '3.2'
1544
-
1545
- it 'raises an exception' do
1546
- expect {
1547
- result
1548
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
1549
- end
1550
-
1551
- context 'when a String key is used' do
1552
-
1553
- let(:options) do
1554
- { 'collation' => { locale: 'en_US', strength: 2 } }
1555
- end
1556
-
1557
- it 'raises an exception' do
1558
- expect {
1559
- result
1560
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
1561
- end
1562
- end
1563
- end
1564
- end
1565
-
1566
- context 'when collation is not specified' do
1567
-
1568
- let(:selector) do
1569
- { name: 'BANG' }
1570
- end
1571
-
1572
- let(:result) do
1573
- authorized_collection.delete_one(selector)
1574
- end
1575
-
1576
- before do
1577
- authorized_collection.insert_one(name: 'bang')
1578
- end
1579
-
1580
- it 'does not apply the collation' do
1581
- expect(result.written_count).to eq(0)
1582
- expect(authorized_collection.find(name: 'bang').count).to eq(1)
1583
- end
1584
- end
1585
-
1586
- context 'when various options passed in' do
1587
- # w: 2 requires a replica set
1588
- require_topology :replica_set
1589
-
1590
- # https://jira.mongodb.org/browse/RUBY-2306
1591
- min_server_fcv '3.6'
1592
-
1593
- before do
1594
- authorized_collection.insert_many([{ name: 'test1' }, { name: 'test2' }])
1595
- end
1596
-
1597
- let(:selector) do
1598
- {name: 'test2'}
1599
- end
1600
-
1601
- let(:session) do
1602
- authorized_client.start_session
1603
- end
1604
-
1605
- let(:events) do
1606
- subscriber.command_started_events('delete')
1607
- end
1608
-
1609
- let(:collection) do
1610
- authorized_collection.with(write_concern: {w: 2})
1611
- end
1612
-
1613
- let!(:command) do
1614
- Utils.get_command_event(authorized_client, 'delete') do |client|
1615
- collection.delete_one(selector, session: session, write_concern: {w: 1},
1616
- bypass_document_validation: true)
1617
- end.command
1618
- end
1619
-
1620
- it 'deletes one successfully with correct options sent to server' do
1621
- expect(events.length).to eq(1)
1622
- expect(command[:writeConcern]).to_not be_nil
1623
- expect(command[:writeConcern][:w]).to eq(1)
1624
- expect(command[:bypassDocumentValidation]).to eq(true)
1625
- end
1626
- end
1627
- end
1628
-
1629
- describe '#delete_many' do
1630
-
1631
- before do
1632
- authorized_collection.insert_many([{ field: 'test1' }, { field: 'test2' }])
1633
- end
1634
-
1635
- context 'when a selector was provided' do
1636
-
1637
- let(:selector) do
1638
- { field: 'test1' }
1639
- end
1640
-
1641
- it 'deletes the matching documents in the collection' do
1642
- expect(authorized_collection.delete_many(selector).deleted_count).to eq(1)
1643
- end
1644
- end
1645
-
1646
- context 'when no selector was provided' do
1647
-
1648
- it 'deletes all the documents in the collection' do
1649
- expect(authorized_collection.delete_many.deleted_count).to eq(2)
1650
- end
1651
- end
1652
-
1653
- context 'when the deletes fail' do
1654
- require_topology :single
1655
-
1656
- let(:result) do
1657
- collection_invalid_write_concern.delete_many
1658
- end
1659
-
1660
- it 'raises an OperationFailure' do
1661
- expect {
1662
- result
1663
- }.to raise_exception(Mongo::Error::OperationFailure)
1664
- end
1665
- end
1666
-
1667
- context 'when a session is provided' do
1668
-
1669
- let(:session) do
1670
- authorized_client.start_session
1671
- end
1672
-
1673
- let(:operation) do
1674
- authorized_collection.delete_many({}, session: session)
1675
- end
1676
-
1677
- let(:failed_operation) do
1678
- authorized_collection.delete_many({ '$._id' => 1}, session: session)
1679
- end
1680
-
1681
- let(:client) do
1682
- authorized_client
1683
- end
1684
-
1685
- it_behaves_like 'an operation using a session'
1686
- it_behaves_like 'a failed operation using a session'
1687
- end
1688
-
1689
- context 'when unacknowledged writes are used with an explicit session' do
1690
-
1691
- let(:collection_with_unacknowledged_write_concern) do
1692
- authorized_collection.with(write: { w: 0 })
1693
- end
1694
-
1695
- let(:operation) do
1696
- collection_with_unacknowledged_write_concern.delete_many({ '$._id' => 1}, session: session)
1697
- end
1698
-
1699
- it_behaves_like 'an explicit session with an unacknowledged write'
1700
- end
1701
-
1702
- context 'when unacknowledged writes are used with an implicit session' do
1703
-
1704
- let(:collection_with_unacknowledged_write_concern) do
1705
- client.with(write: { w: 0 })[TEST_COLL]
1706
- end
1707
-
1708
- let(:operation) do
1709
- collection_with_unacknowledged_write_concern.delete_many({ '$._id' => 1 })
1710
- end
1711
-
1712
- it_behaves_like 'an implicit session with an unacknowledged write'
1713
- end
1714
-
1715
- context 'when a collation is specified' do
1716
-
1717
- let(:selector) do
1718
- { name: 'BANG' }
1719
- end
1720
-
1721
- let(:result) do
1722
- authorized_collection.delete_many(selector, options)
1723
- end
1724
-
1725
- before do
1726
- authorized_collection.insert_one(name: 'bang')
1727
- authorized_collection.insert_one(name: 'bang')
1728
- end
1729
-
1730
- let(:options) do
1731
- { collation: { locale: 'en_US', strength: 2 } }
1732
- end
1733
-
1734
- context 'when the server selected supports collations' do
1735
- min_server_fcv '3.4'
1736
-
1737
- it 'applies the collation' do
1738
- expect(result.written_count).to eq(2)
1739
- expect(authorized_collection.find(name: 'bang').count).to eq(0)
1740
- end
1741
-
1742
- context 'when unacknowledged writes is used' do
1743
-
1744
- let(:collection_with_unacknowledged_write_concern) do
1745
- authorized_collection.with(write: { w: 0 })
1746
- end
1747
-
1748
- let(:result) do
1749
- collection_with_unacknowledged_write_concern.delete_many(selector, options)
1750
- end
1751
-
1752
- it 'raises an exception' do
1753
- expect {
1754
- result
1755
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
1756
- end
1757
-
1758
- context 'when a String key is used' do
1759
-
1760
- let(:options) do
1761
- { 'collation' => { locale: 'en_US', strength: 2 } }
1762
- end
1763
-
1764
- it 'raises an exception' do
1765
- expect {
1766
- result
1767
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
1768
- end
1769
- end
1770
- end
1771
- end
1772
-
1773
- context 'when the server selected does not support collations' do
1774
- max_server_version '3.2'
1775
-
1776
- it 'raises an exception' do
1777
- expect {
1778
- result
1779
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
1780
- end
1781
-
1782
- context 'when a String key is used' do
1783
-
1784
- let(:options) do
1785
- { 'collation' => { locale: 'en_US', strength: 2 } }
1786
- end
1787
-
1788
- it 'raises an exception' do
1789
- expect {
1790
- result
1791
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
1792
- end
1793
- end
1794
- end
1795
- end
1796
-
1797
- context 'when a collation is not specified' do
1798
-
1799
- let(:selector) do
1800
- { name: 'BANG' }
1801
- end
1802
-
1803
- let(:result) do
1804
- authorized_collection.delete_many(selector)
1805
- end
1806
-
1807
- before do
1808
- authorized_collection.insert_one(name: 'bang')
1809
- authorized_collection.insert_one(name: 'bang')
1810
- end
1811
-
1812
- it 'does not apply the collation' do
1813
- expect(result.written_count).to eq(0)
1814
- expect(authorized_collection.find(name: 'bang').count).to eq(2)
1815
- end
1816
- end
1817
-
1818
- context 'when various options passed in' do
1819
- # w: 2 requires a replica set
1820
- require_topology :replica_set
1821
-
1822
- # https://jira.mongodb.org/browse/RUBY-2306
1823
- min_server_fcv '3.6'
1824
-
1825
- before do
1826
- collection.insert_many([{ name: 'test1' }, { name: 'test2' }, { name: 'test3'}])
1827
- end
1828
-
1829
- let(:selector) do
1830
- {name: 'test1'}
1831
- end
1832
-
1833
- let(:session) do
1834
- authorized_client.start_session
1835
- end
1836
-
1837
- let(:events) do
1838
- subscriber.command_started_events('delete')
1839
- end
1840
-
1841
- let(:collection) do
1842
- authorized_collection.with(write_concern: {w: 1})
1843
- end
1844
-
1845
- let!(:command) do
1846
- Utils.get_command_event(authorized_client, 'delete') do |client|
1847
- collection.delete_many(selector, session: session, write_concern: {w: 2},
1848
- bypass_document_validation: true)
1849
- end.command
1850
- end
1851
-
1852
- it 'deletes many successfully with correct options sent to server' do
1853
- expect(events.length).to eq(1)
1854
- expect(command[:writeConcern]).to_not be_nil
1855
- expect(command[:writeConcern][:w]).to eq(2)
1856
- expect(command[:bypassDocumentValidation]).to be(true)
1857
- end
1858
- end
1859
- end
1860
-
1861
- describe '#parallel_scan' do
1862
- max_server_version '4.0'
1863
- require_topology :single, :replica_set
1864
-
1865
- let(:documents) do
1866
- (1..200).map do |i|
1867
- { name: "testing-scan-#{i}" }
1868
- end
1869
- end
1870
-
1871
- before do
1872
- authorized_collection.insert_many(documents)
1873
- end
1874
-
1875
- let(:cursors) do
1876
- authorized_collection.parallel_scan(2)
1877
- end
1878
-
1879
- it 'returns an array of cursors' do
1880
- cursors.each do |cursor|
1881
- expect(cursor.class).to be(Mongo::Cursor)
1882
- end
1883
- end
1884
-
1885
- it 'returns the correct number of documents' do
1886
- expect(
1887
- cursors.reduce(0) { |total, cursor| total + cursor.to_a.size }
1888
- ).to eq(200)
1889
- end
1890
-
1891
- context 'when a session is provided' do
1892
- require_wired_tiger
1893
-
1894
- let(:cursors) do
1895
- authorized_collection.parallel_scan(2, session: session)
1896
- end
1897
-
1898
- let(:operation) do
1899
- cursors.reduce(0) { |total, cursor| total + cursor.to_a.size }
1900
- end
1901
-
1902
- let(:failed_operation) do
1903
- authorized_collection.parallel_scan(-2, session: session)
1904
- end
1905
-
1906
- let(:client) do
1907
- authorized_client
1908
- end
1909
-
1910
- it_behaves_like 'an operation using a session'
1911
- it_behaves_like 'a failed operation using a session'
1912
- end
1913
-
1914
- context 'when a session is not provided' do
1915
- let(:collection) { client['test'] }
1916
-
1917
- let(:cursors) do
1918
- collection.parallel_scan(2)
1919
- end
1920
-
1921
- let(:operation) do
1922
- cursors.reduce(0) { |total, cursor| total + cursor.to_a.size }
1923
- end
1924
-
1925
- let(:failed_operation) do
1926
- collection.parallel_scan(-2)
1927
- end
1928
-
1929
- let(:command) do
1930
- operation
1931
- event = subscriber.started_events.find { |cmd| cmd.command_name == 'parallelCollectionScan' }
1932
- expect(event).not_to be_nil
1933
- event.command
1934
- end
1935
-
1936
- it_behaves_like 'an operation not using a session'
1937
- it_behaves_like 'a failed operation not using a session'
1938
- end
1939
-
1940
- context 'when a session supporting causal consistency is used' do
1941
- require_wired_tiger
1942
-
1943
- before do
1944
- collection.drop
1945
- collection.create
1946
- end
1947
-
1948
- let(:cursors) do
1949
- collection.parallel_scan(2, session: session)
1950
- end
1951
-
1952
- let(:operation) do
1953
- cursors.reduce(0) { |total, cursor| total + cursor.to_a.size }
1954
- end
1955
-
1956
- let(:command) do
1957
- operation
1958
- event = subscriber.started_events.find { |cmd| cmd.command_name == 'parallelCollectionScan' }
1959
- expect(event).not_to be_nil
1960
- event.command
1961
- end
1962
-
1963
- it_behaves_like 'an operation supporting causally consistent reads'
1964
- end
1965
-
1966
- context 'when a read concern is provided' do
1967
- require_wired_tiger
1968
- min_server_fcv '3.2'
1969
-
1970
- let(:result) do
1971
- authorized_collection.with(options).parallel_scan(2)
1972
- end
1973
-
1974
- context 'when the read concern is valid' do
1975
-
1976
- let(:options) do
1977
- { read_concern: { level: 'local' }}
1978
- end
1979
-
1980
- it 'sends the read concern' do
1981
- expect { result }.to_not raise_error
1982
- end
1983
- end
1984
-
1985
- context 'when the read concern is not valid' do
1986
-
1987
- let(:options) do
1988
- { read_concern: { level: 'idontknow' }}
1989
- end
1990
-
1991
- it 'raises an exception' do
1992
- expect {
1993
- result
1994
- }.to raise_error(Mongo::Error::OperationFailure)
1995
- end
1996
- end
1997
- end
1998
-
1999
- context 'when the collection has a read preference' do
2000
- require_topology :single, :replica_set
2001
-
2002
- before do
2003
- allow(collection.client.cluster).to receive(:single?).and_return(false)
2004
- end
2005
-
2006
- let(:client) do
2007
- authorized_client.with(server_selection_timeout: 0.2)
2008
- end
2009
-
2010
- let(:collection) do
2011
- client[authorized_collection.name,
2012
- read: { :mode => :secondary, :tag_sets => [{ 'non' => 'existent' }] }]
2013
- end
2014
-
2015
- let(:result) do
2016
- collection.parallel_scan(2)
2017
- end
2018
-
2019
- it 'uses that read preference' do
2020
- expect {
2021
- result
2022
- }.to raise_exception(Mongo::Error::NoServerAvailable)
2023
- end
2024
- end
2025
-
2026
- context 'when a max time ms value is provided' do
2027
- require_topology :single, :replica_set
2028
-
2029
- let(:result) do
2030
- authorized_collection.parallel_scan(2, options)
2031
- end
2032
-
2033
- context 'when the read concern is valid' do
2034
-
2035
- let(:options) do
2036
- { max_time_ms: 5 }
2037
- end
2038
-
2039
- it 'sends the max time ms value' do
2040
- expect { result }.to_not raise_error
2041
- end
2042
- end
2043
-
2044
- context 'when the max time ms is not valid' do
2045
-
2046
- let(:options) do
2047
- { max_time_ms: 0.1 }
2048
- end
2049
-
2050
- it 'raises an exception' do
2051
- expect {
2052
- result
2053
- }.to raise_error(Mongo::Error::OperationFailure)
2054
- end
2055
- end
2056
- end
2057
- end
2058
-
2059
- describe '#replace_one' do
2060
-
2061
- let(:selector) do
2062
- { field: 'test1' }
2063
- end
2064
-
2065
- context 'when a selector was provided' do
2066
-
2067
- before do
2068
- authorized_collection.insert_many([{ field: 'test1' }, { field: 'test1' }])
2069
- end
2070
-
2071
- let!(:response) do
2072
- authorized_collection.replace_one(selector, { field: 'testing' })
2073
- end
2074
-
2075
- let(:updated) do
2076
- authorized_collection.find(field: 'testing').first
2077
- end
2078
-
2079
- it 'updates the first matching document in the collection' do
2080
- expect(response.modified_count).to eq(1)
2081
- end
2082
-
2083
- it 'updates the documents in the collection' do
2084
- expect(updated[:field]).to eq('testing')
2085
- end
2086
- end
2087
-
2088
- context 'when upsert is false' do
2089
-
2090
- let!(:response) do
2091
- authorized_collection.replace_one(selector, { field: 'test1' }, upsert: false)
2092
- end
2093
-
2094
- let(:updated) do
2095
- authorized_collection.find(field: 'test1').to_a
2096
- end
2097
-
2098
- it 'reports that no documents were written' do
2099
- expect(response.modified_count).to eq(0)
2100
- end
2101
-
2102
- it 'does not insert the document' do
2103
- expect(updated).to be_empty
2104
- end
2105
- end
2106
-
2107
- context 'when upsert is true' do
2108
-
2109
- let!(:response) do
2110
- authorized_collection.replace_one(selector, { field: 'test1' }, upsert: true)
2111
- end
2112
-
2113
- let(:updated) do
2114
- authorized_collection.find(field: 'test1').first
2115
- end
2116
-
2117
- it 'reports that a document was written' do
2118
- expect(response.written_count).to eq(1)
2119
- end
2120
-
2121
- it 'inserts the document' do
2122
- expect(updated[:field]).to eq('test1')
2123
- end
2124
- end
2125
-
2126
- context 'when upsert is not specified' do
2127
-
2128
- let!(:response) do
2129
- authorized_collection.replace_one(selector, { field: 'test1' })
2130
- end
2131
-
2132
- let(:updated) do
2133
- authorized_collection.find(field: 'test1').to_a
2134
- end
2135
-
2136
- it 'reports that no documents were written' do
2137
- expect(response.modified_count).to eq(0)
2138
- end
2139
-
2140
- it 'does not insert the document' do
2141
- expect(updated).to be_empty
2142
- end
2143
- end
2144
-
2145
- context 'when the replace has an invalid key' do
2146
-
2147
- context "when validate_update_replace is true" do
2148
-
2149
- config_override :validate_update_replace, true
2150
-
2151
- let(:result) do
2152
- authorized_collection.replace_one(selector, { '$s' => 'test1' })
2153
- end
2154
-
2155
- it 'raises an InvalidReplacementDocument error' do
2156
- expect {
2157
- result
2158
- }.to raise_exception(Mongo::Error::InvalidReplacementDocument)
2159
- end
2160
- end
2161
-
2162
- context "when validate_update_replace is false" do
2163
-
2164
- config_override :validate_update_replace, false
2165
-
2166
- let(:result) do
2167
- authorized_collection.replace_one(selector, { '$set' => { 'test1' => 1 } })
2168
- end
2169
-
2170
- it 'does not raise an error' do
2171
- expect {
2172
- result
2173
- }.to_not raise_exception
2174
- end
2175
- end
2176
- end
2177
-
2178
- context 'when collection has a validator' do
2179
- min_server_fcv '3.2'
2180
-
2181
- around(:each) do |spec|
2182
- collection_with_validator.drop
2183
- authorized_client[:validating,
2184
- :validator => { :a => { '$exists' => true } }].tap do |c|
2185
- c.create
2186
- end
2187
- spec.run
2188
- collection_with_validator.drop
2189
- end
2190
-
2191
- before do
2192
- collection_with_validator.insert_one({ a: 1 })
2193
- end
2194
-
2195
- context 'when the document is valid' do
2196
-
2197
- let(:result) do
2198
- collection_with_validator.replace_one({ a: 1 }, { a: 5 })
2199
- end
2200
-
2201
- it 'replaces successfully' do
2202
- expect(result.modified_count).to eq(1)
2203
- end
2204
- end
2205
-
2206
- context 'when the document is invalid' do
2207
-
2208
- context 'when bypass_document_validation is not set' do
2209
-
2210
- let(:result2) do
2211
- collection_with_validator.replace_one({ a: 1 }, { x: 5 })
2212
- end
2213
-
2214
- it 'raises OperationFailure' do
2215
- expect {
2216
- result2
2217
- }.to raise_exception(Mongo::Error::OperationFailure)
2218
- end
2219
- end
2220
-
2221
- context 'when bypass_document_validation is true' do
2222
-
2223
- let(:result3) do
2224
- collection_with_validator.replace_one(
2225
- { a: 1 }, { x: 1 }, :bypass_document_validation => true)
2226
- end
2227
-
2228
- it 'replaces successfully' do
2229
- expect(result3.written_count).to eq(1)
2230
- end
2231
- end
2232
- end
2233
- end
2234
-
2235
- context 'when a collation is specified' do
2236
-
2237
- let(:selector) do
2238
- { name: 'BANG' }
2239
- end
2240
-
2241
- let(:result) do
2242
- authorized_collection.replace_one(selector, { name: 'doink' }, options)
2243
- end
2244
-
2245
- before do
2246
- authorized_collection.insert_one(name: 'bang')
2247
- end
2248
-
2249
- let(:options) do
2250
- { collation: { locale: 'en_US', strength: 2 } }
2251
- end
2252
-
2253
- context 'when the server selected supports collations' do
2254
- min_server_fcv '3.4'
2255
-
2256
- it 'applies the collation' do
2257
- expect(result.written_count).to eq(1)
2258
- expect(authorized_collection.find(name: 'doink').count).to eq(1)
2259
- end
2260
-
2261
- context 'when unacknowledged writes is used' do
2262
-
2263
- let(:collection_with_unacknowledged_write_concern) do
2264
- authorized_collection.with(write: { w: 0 })
2265
- end
2266
-
2267
- let(:result) do
2268
- collection_with_unacknowledged_write_concern.replace_one(selector, { name: 'doink' }, options)
2269
- end
2270
-
2271
- it 'raises an exception' do
2272
- expect {
2273
- result
2274
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
2275
- end
2276
-
2277
- context 'when a String key is used' do
2278
-
2279
- let(:options) do
2280
- { 'collation' => { locale: 'en_US', strength: 2 } }
2281
- end
2282
-
2283
- it 'raises an exception' do
2284
- expect {
2285
- result
2286
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
2287
- end
2288
- end
2289
- end
2290
- end
2291
-
2292
- context 'when the server selected does not support collations' do
2293
- max_server_version '3.2'
2294
-
2295
- it 'raises an exception' do
2296
- expect {
2297
- result
2298
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
2299
- end
2300
-
2301
- context 'when a String key is used' do
2302
-
2303
- let(:options) do
2304
- { 'collation' => { locale: 'en_US', strength: 2 } }
2305
- end
2306
-
2307
- it 'raises an exception' do
2308
- expect {
2309
- result
2310
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
2311
- end
2312
- end
2313
- end
2314
- end
2315
-
2316
- context 'when a collation is not specified' do
2317
-
2318
- let(:selector) do
2319
- { name: 'BANG' }
2320
- end
2321
-
2322
- let(:result) do
2323
- authorized_collection.replace_one(selector, { name: 'doink' })
2324
- end
2325
-
2326
- before do
2327
- authorized_collection.insert_one(name: 'bang')
2328
- end
2329
-
2330
- it 'does not apply the collation' do
2331
- expect(result.written_count).to eq(0)
2332
- expect(authorized_collection.find(name: 'bang').count).to eq(1)
2333
- end
2334
- end
2335
-
2336
- context 'when a session is provided' do
2337
-
2338
- let(:selector) do
2339
- { name: 'BANG' }
2340
- end
2341
-
2342
- before do
2343
- authorized_collection.insert_one(name: 'bang')
2344
- end
2345
-
2346
- let(:session) do
2347
- authorized_client.start_session
2348
- end
2349
-
2350
- let(:operation) do
2351
- authorized_collection.replace_one(selector, { name: 'doink' }, session: session)
2352
- end
2353
-
2354
- let(:failed_operation) do
2355
- authorized_collection.replace_one({ '$._id' => 1 }, { name: 'doink' }, session: session)
2356
- end
2357
-
2358
- let(:client) do
2359
- authorized_client
2360
- end
2361
-
2362
- it_behaves_like 'an operation using a session'
2363
- it_behaves_like 'a failed operation using a session'
2364
- end
2365
-
2366
- context 'when unacknowledged writes is used with an explicit session' do
2367
-
2368
- let(:collection_with_unacknowledged_write_concern) do
2369
- authorized_collection.with(write: { w: 0 })
2370
- end
2371
-
2372
- let(:operation) do
2373
- collection_with_unacknowledged_write_concern.replace_one({ a: 1 }, { x: 5 }, session: session)
2374
- end
2375
-
2376
- it_behaves_like 'an explicit session with an unacknowledged write'
2377
- end
2378
-
2379
- context 'when unacknowledged writes is used with an implicit session' do
2380
-
2381
- let(:collection_with_unacknowledged_write_concern) do
2382
- client.with(write: { w: 0 })[TEST_COLL]
2383
- end
2384
-
2385
- let(:operation) do
2386
- collection_with_unacknowledged_write_concern.replace_one({ a: 1 }, { x: 5 })
2387
- end
2388
-
2389
- it_behaves_like 'an implicit session with an unacknowledged write'
2390
- end
2391
-
2392
- context 'when various options passed in' do
2393
- # w: 2 requires a replica set
2394
- require_topology :replica_set
2395
-
2396
- # https://jira.mongodb.org/browse/RUBY-2306
2397
- min_server_fcv '3.6'
2398
-
2399
- before do
2400
- authorized_collection.insert_one({field: 'test1'})
2401
- end
2402
-
2403
- let(:session) do
2404
- authorized_client.start_session
2405
- end
2406
-
2407
- let(:events) do
2408
- subscriber.command_started_events('update')
2409
- end
2410
-
2411
- let(:collection) do
2412
- authorized_collection.with(write_concern: {w: 3})
2413
- end
2414
-
2415
- let(:updated) do
2416
- collection.find(field: 'test4').first
2417
- end
2418
-
2419
- let!(:command) do
2420
- Utils.get_command_event(authorized_client, 'update') do |client|
2421
- collection.replace_one(selector, { field: 'test4'},
2422
- session: session, :return_document => :after, write_concern: {w: 2},
2423
- upsert: true, bypass_document_validation: true)
2424
- end.command
2425
- end
2426
-
2427
- it 'replaced one successfully with correct options sent to server' do
2428
- expect(updated[:field]).to eq('test4')
2429
- expect(events.length).to eq(1)
2430
- expect(command[:writeConcern]).to_not be_nil
2431
- expect(command[:writeConcern][:w]).to eq(2)
2432
- expect(command[:bypassDocumentValidation]).to be(true)
2433
- expect(command[:updates][0][:upsert]).to be(true)
2434
- end
2435
- end
2436
- end
2437
-
2438
- describe '#update_many' do
2439
-
2440
- let(:selector) do
2441
- { field: 'test' }
2442
- end
2443
-
2444
- context 'when a selector was provided' do
2445
-
2446
- before do
2447
- authorized_collection.insert_many([{ field: 'test' }, { field: 'test' }])
2448
- end
2449
-
2450
- let!(:response) do
2451
- authorized_collection.update_many(selector, '$set'=> { field: 'testing' })
2452
- end
2453
-
2454
- let(:updated) do
2455
- authorized_collection.find(field: 'testing').to_a.last
2456
- end
2457
-
2458
- it 'returns the number updated' do
2459
- expect(response.modified_count).to eq(2)
2460
- end
2461
-
2462
- it 'updates the documents in the collection' do
2463
- expect(updated[:field]).to eq('testing')
2464
- end
2465
- end
2466
-
2467
- context 'when upsert is false' do
2468
-
2469
- let(:response) do
2470
- authorized_collection.update_many(selector, { '$set'=> { field: 'testing' } },
2471
- upsert: false)
2472
- end
2473
-
2474
- let(:updated) do
2475
- authorized_collection.find.to_a
2476
- end
2477
-
2478
- it 'reports that no documents were updated' do
2479
- expect(response.modified_count).to eq(0)
2480
- end
2481
-
2482
- it 'updates no documents in the collection' do
2483
- expect(updated).to be_empty
2484
- end
2485
- end
2486
-
2487
- context 'when upsert is true' do
2488
-
2489
- let!(:response) do
2490
- authorized_collection.update_many(selector, { '$set'=> { field: 'testing' } },
2491
- upsert: true)
2492
- end
2493
-
2494
- let(:updated) do
2495
- authorized_collection.find.sort(_id: 1).to_a.last
2496
- end
2497
-
2498
- it 'reports that a document was written' do
2499
- expect(response.written_count).to eq(1)
2500
- end
2501
-
2502
- it 'inserts a document into the collection' do
2503
- expect(updated[:field]).to eq('testing')
2504
- end
2505
- end
2506
-
2507
- context 'when upsert is not specified' do
2508
-
2509
- let(:response) do
2510
- authorized_collection.update_many(selector, { '$set'=> { field: 'testing' } })
2511
- end
2512
-
2513
- let(:updated) do
2514
- authorized_collection.find.to_a
2515
- end
2516
-
2517
- it 'reports that no documents were updated' do
2518
- expect(response.modified_count).to eq(0)
2519
- end
2520
-
2521
- it 'updates no documents in the collection' do
2522
- expect(updated).to be_empty
2523
- end
2524
- end
2525
-
2526
- context 'when arrayFilters is provided' do
2527
-
2528
- let(:selector) do
2529
- { '$or' => [{ _id: 0 }, { _id: 1 }]}
2530
- end
2531
-
2532
- context 'when the server supports arrayFilters' do
2533
- min_server_fcv '3.6'
2534
-
2535
- before do
2536
- authorized_collection.insert_many([{
2537
- _id: 0, x: [
2538
- { y: 1 },
2539
- { y: 2 },
2540
- { y: 3 }
2541
- ]
2542
- },
2543
- {
2544
- _id: 1,
2545
- x: [
2546
- { y: 3 },
2547
- { y: 2 },
2548
- { y: 1 }
2549
- ]
2550
- }])
2551
- end
2552
-
2553
- let(:result) do
2554
- authorized_collection.update_many(selector,
2555
- { '$set' => { 'x.$[i].y' => 5 } },
2556
- options)
2557
- end
2558
-
2559
- context 'when a Symbol key is used' do
2560
-
2561
- let(:options) do
2562
- { array_filters: [{ 'i.y' => 3 }] }
2563
- end
2564
-
2565
- it 'applies the arrayFilters' do
2566
- expect(result.matched_count).to eq(2)
2567
- expect(result.modified_count).to eq(2)
2568
-
2569
- docs = authorized_collection.find(selector, sort: { _id: 1 }).to_a
2570
- expect(docs[0]['x']).to eq ([{ 'y' => 1 }, { 'y' => 2 }, { 'y' => 5 }])
2571
- expect(docs[1]['x']).to eq ([{ 'y' => 5 }, { 'y' => 2 }, { 'y' => 1 }])
2572
- end
2573
- end
2574
-
2575
- context 'when a String key is used' do
2576
- let(:options) do
2577
- { 'array_filters' => [{ 'i.y' => 3 }] }
2578
- end
2579
-
2580
- it 'applies the arrayFilters' do
2581
- expect(result.matched_count).to eq(2)
2582
- expect(result.modified_count).to eq(2)
2583
-
2584
- docs = authorized_collection.find({}, sort: { _id: 1 }).to_a
2585
- expect(docs[0]['x']).to eq ([{ 'y' => 1 }, { 'y' => 2 }, { 'y' => 5 }])
2586
- expect(docs[1]['x']).to eq ([{ 'y' => 5 }, { 'y' => 2 }, { 'y' => 1 }])
2587
- end
2588
- end
2589
- end
2590
-
2591
- context 'when the server does not support arrayFilters' do
2592
- max_server_version '3.4'
2593
-
2594
- let(:result) do
2595
- authorized_collection.update_many(selector,
2596
- { '$set' => { 'x.$[i].y' => 5 } },
2597
- options)
2598
- end
2599
-
2600
- context 'when a Symbol key is used' do
2601
-
2602
- let(:options) do
2603
- { array_filters: [{ 'i.y' => 3 }] }
2604
- end
2605
-
2606
- it 'raises an exception' do
2607
- expect {
2608
- result
2609
- }.to raise_exception(Mongo::Error::UnsupportedArrayFilters)
2610
- end
2611
- end
2612
-
2613
- context 'when a String key is used' do
2614
-
2615
- let(:options) do
2616
- { 'array_filters' => [{ 'i.y' => 3 }] }
2617
- end
2618
-
2619
- it 'raises an exception' do
2620
- expect {
2621
- result
2622
- }.to raise_exception(Mongo::Error::UnsupportedArrayFilters)
2623
- end
2624
- end
2625
- end
2626
- end
2627
-
2628
- context 'when the updates fail' do
2629
-
2630
- let(:result) do
2631
- authorized_collection.update_many(selector, { '$s'=> { field: 'testing' } })
2632
- end
2633
-
2634
- it 'raises an OperationFailure' do
2635
- expect {
2636
- result
2637
- }.to raise_exception(Mongo::Error::OperationFailure)
2638
- end
2639
- end
2640
-
2641
- context 'when collection has a validator' do
2642
- min_server_fcv '3.2'
2643
-
2644
- around(:each) do |spec|
2645
- authorized_client[:validating,
2646
- :validator => { :a => { '$exists' => true } }].tap do |c|
2647
- c.create
2648
- end
2649
- spec.run
2650
- collection_with_validator.drop
2651
- end
2652
-
2653
- before do
2654
- collection_with_validator.insert_many([{ a: 1 }, { a: 2 }])
2655
- end
2656
-
2657
- context 'when the document is valid' do
2658
-
2659
- let(:result) do
2660
- collection_with_validator.update_many(
2661
- { :a => { '$gt' => 0 } }, '$inc' => { :a => 1 } )
2662
- end
2663
-
2664
- it 'updates successfully' do
2665
- expect(result.modified_count).to eq(2)
2666
- end
2667
- end
2668
-
2669
- context 'when the document is invalid' do
2670
-
2671
- context 'when bypass_document_validation is not set' do
2672
-
2673
- let(:result2) do
2674
- collection_with_validator.update_many(
2675
- { :a => { '$gt' => 0 } }, '$unset' => { :a => '' })
2676
- end
2677
-
2678
- it 'raises OperationFailure' do
2679
- expect {
2680
- result2
2681
- }.to raise_exception(Mongo::Error::OperationFailure)
2682
- end
2683
- end
2684
-
2685
- context 'when bypass_document_validation is true' do
2686
-
2687
- let(:result3) do
2688
- collection_with_validator.update_many(
2689
- { :a => { '$gt' => 0 } }, { '$unset' => { :a => '' } },
2690
- :bypass_document_validation => true)
2691
- end
2692
-
2693
- it 'updates successfully' do
2694
- expect(result3.written_count).to eq(2)
2695
- end
2696
- end
2697
- end
2698
- end
2699
-
2700
- context 'when a collation is specified' do
2701
-
2702
- let(:selector) do
2703
- { name: 'BANG' }
2704
- end
2705
-
2706
- let(:result) do
2707
- authorized_collection.update_many(selector, { '$set' => { other: 'doink' } }, options)
2708
- end
2709
-
2710
- before do
2711
- authorized_collection.insert_one(name: 'bang')
2712
- authorized_collection.insert_one(name: 'baNG')
2713
- end
2714
-
2715
- let(:options) do
2716
- { collation: { locale: 'en_US', strength: 2 } }
2717
- end
2718
-
2719
- context 'when the server selected supports collations' do
2720
- min_server_fcv '3.4'
2721
-
2722
- it 'applies the collation' do
2723
- expect(result.written_count).to eq(2)
2724
- expect(authorized_collection.find(other: 'doink').count).to eq(2)
2725
- end
2726
-
2727
- context 'when unacknowledged writes is used' do
2728
-
2729
- let(:collection_with_unacknowledged_write_concern) do
2730
- authorized_collection.with(write: { w: 0 })
2731
- end
2732
-
2733
- let(:result) do
2734
- collection_with_unacknowledged_write_concern.update_many(selector, { '$set' => { other: 'doink' } }, options)
2735
- end
2736
-
2737
- it 'raises an exception' do
2738
- expect {
2739
- result
2740
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
2741
- end
2742
-
2743
- context 'when a String key is used' do
2744
-
2745
- let(:options) do
2746
- { 'collation' => { locale: 'en_US', strength: 2 } }
2747
- end
2748
-
2749
- it 'raises an exception' do
2750
- expect {
2751
- result
2752
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
2753
- end
2754
- end
2755
- end
2756
- end
2757
-
2758
- context 'when the server selected does not support collations' do
2759
- max_server_version '3.2'
2760
-
2761
- it 'raises an exception' do
2762
- expect {
2763
- result
2764
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
2765
- end
2766
-
2767
- context 'when a String key is used' do
2768
-
2769
- let(:options) do
2770
- { 'collation' => { locale: 'en_US', strength: 2 } }
2771
- end
2772
-
2773
- it 'raises an exception' do
2774
- expect {
2775
- result
2776
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
2777
- end
2778
- end
2779
- end
2780
- end
2781
-
2782
- context 'when collation is not specified' do
2783
-
2784
- let(:selector) do
2785
- {name: 'BANG'}
2786
- end
2787
-
2788
- let(:result) do
2789
- authorized_collection.update_many(selector, { '$set' => {other: 'doink'} })
2790
- end
2791
-
2792
- before do
2793
- authorized_collection.insert_one(name: 'bang')
2794
- authorized_collection.insert_one(name: 'baNG')
2795
- end
2796
-
2797
- it 'does not apply the collation' do
2798
- expect(result.written_count).to eq(0)
2799
- end
2800
- end
2801
-
2802
- context 'when a session is provided' do
2803
-
2804
- let(:selector) do
2805
- { name: 'BANG' }
2806
- end
2807
-
2808
- let(:operation) do
2809
- authorized_collection.update_many(selector, { '$set' => {other: 'doink'} }, session: session)
2810
- end
2811
-
2812
- before do
2813
- authorized_collection.insert_one(name: 'bang')
2814
- authorized_collection.insert_one(name: 'baNG')
2815
- end
2816
-
2817
- let(:session) do
2818
- authorized_client.start_session
2819
- end
2820
-
2821
- let(:failed_operation) do
2822
- authorized_collection.update_many({ '$._id' => 1 }, { '$set' => {other: 'doink'} }, session: session)
2823
- end
2824
-
2825
- let(:client) do
2826
- authorized_client
2827
- end
2828
-
2829
- it_behaves_like 'an operation using a session'
2830
- it_behaves_like 'a failed operation using a session'
2831
- end
2832
-
2833
- context 'when unacknowledged writes is used with an explicit session' do
2834
-
2835
- let(:collection_with_unacknowledged_write_concern) do
2836
- authorized_collection.with(write: { w: 0 })
2837
- end
2838
-
2839
- let(:operation) do
2840
- collection_with_unacknowledged_write_concern.update_many({a: 1}, { '$set' => {x: 1} }, session: session)
2841
- end
2842
-
2843
- it_behaves_like 'an explicit session with an unacknowledged write'
2844
- end
2845
-
2846
- context 'when unacknowledged writes is used with an implicit session' do
2847
-
2848
- let(:collection_with_unacknowledged_write_concern) do
2849
- client.with(write: { w: 0 })[TEST_COLL]
2850
- end
2851
-
2852
- let(:operation) do
2853
- collection_with_unacknowledged_write_concern.update_many({a: 1}, {'$set' => {x: 1}})
2854
- end
2855
-
2856
- it_behaves_like 'an implicit session with an unacknowledged write'
2857
- end
2858
-
2859
- context 'when various options passed in' do
2860
- # w: 2 requires a replica set
2861
- require_topology :replica_set
2862
-
2863
- # https://jira.mongodb.org/browse/RUBY-2306
2864
- min_server_fcv '3.6'
2865
-
2866
- before do
2867
- collection.insert_many([{ field: 'test' }, { field: 'test2' }], session: session)
2868
- end
2869
-
2870
- let(:session) do
2871
- authorized_client.start_session
2872
- end
2873
-
2874
- let(:collection) do
2875
- authorized_collection.with(write_concern: {w: 1})
2876
- end
2877
-
2878
- let(:events) do
2879
- subscriber.command_started_events('update')
2880
- end
2881
-
2882
- let!(:command) do
2883
- Utils.get_command_event(authorized_client, 'update') do |client|
2884
- collection.update_many(selector, {'$set'=> { field: 'testing' }}, session: session,
2885
- write_concern: {w: 2}, bypass_document_validation: true, upsert: true)
2886
- end.command
2887
- end
2888
-
2889
- it 'updates many successfully with correct options sent to server' do
2890
- expect(events.length).to eq(1)
2891
- expect(collection.options[:write_concern]).to eq(w: 1)
2892
- expect(command[:writeConcern][:w]).to eq(2)
2893
- expect(command[:bypassDocumentValidation]).to be(true)
2894
- expect(command[:updates][0][:upsert]).to be(true)
2895
- end
2896
- end
2897
- end
2898
-
2899
- describe '#update_one' do
2900
-
2901
- let(:selector) do
2902
- { field: 'test1' }
2903
- end
2904
-
2905
- context 'when a selector was provided' do
2906
-
2907
- before do
2908
- authorized_collection.insert_many([{ field: 'test1' }, { field: 'test1' }])
2909
- end
2910
-
2911
- let!(:response) do
2912
- authorized_collection.update_one(selector, '$set'=> { field: 'testing' })
2913
- end
2914
-
2915
- let(:updated) do
2916
- authorized_collection.find(field: 'testing').first
2917
- end
2918
-
2919
- it 'updates the first matching document in the collection' do
2920
- expect(response.modified_count).to eq(1)
2921
- end
2922
-
2923
- it 'updates the documents in the collection' do
2924
- expect(updated[:field]).to eq('testing')
2925
- end
2926
- end
2927
-
2928
- context 'when upsert is false' do
2929
-
2930
- let(:response) do
2931
- authorized_collection.update_one(selector, { '$set'=> { field: 'testing' } },
2932
- upsert: false)
2933
- end
2934
-
2935
- let(:updated) do
2936
- authorized_collection.find.to_a
2937
- end
2938
-
2939
- it 'reports that no documents were updated' do
2940
- expect(response.modified_count).to eq(0)
2941
- end
2942
-
2943
- it 'updates no documents in the collection' do
2944
- expect(updated).to be_empty
2945
- end
2946
- end
2947
-
2948
- context 'when upsert is true' do
2949
-
2950
- let!(:response) do
2951
- authorized_collection.update_one(selector, { '$set'=> { field: 'testing' } },
2952
- upsert: true)
2953
- end
2954
-
2955
- let(:updated) do
2956
- authorized_collection.find.first
2957
- end
2958
-
2959
- it 'reports that a document was written' do
2960
- expect(response.written_count).to eq(1)
2961
- end
2962
-
2963
- it 'inserts a document into the collection' do
2964
- expect(updated[:field]).to eq('testing')
2965
- end
2966
- end
2967
-
2968
- context 'when upsert is not specified' do
2969
-
2970
- let(:response) do
2971
- authorized_collection.update_one(selector, { '$set'=> { field: 'testing' } })
2972
- end
2973
-
2974
- let(:updated) do
2975
- authorized_collection.find.to_a
2976
- end
2977
-
2978
- it 'reports that no documents were updated' do
2979
- expect(response.modified_count).to eq(0)
2980
- end
2981
-
2982
- it 'updates no documents in the collection' do
2983
- expect(updated).to be_empty
2984
- end
2985
- end
2986
-
2987
- context 'when the update fails' do
2988
-
2989
- let(:result) do
2990
- authorized_collection.update_one(selector, { '$s'=> { field: 'testing' } })
2991
- end
2992
-
2993
- it 'raises an OperationFailure' do
2994
- expect {
2995
- result
2996
- }.to raise_exception(Mongo::Error::OperationFailure)
2997
- end
2998
- end
2999
-
3000
- context 'when collection has a validator' do
3001
- min_server_fcv '3.2'
3002
-
3003
- around(:each) do |spec|
3004
- authorized_client[:validating,
3005
- :validator => { :a => { '$exists' => true } }].tap do |c|
3006
- c.create
3007
- end
3008
- spec.run
3009
- collection_with_validator.drop
3010
- end
3011
-
3012
- before do
3013
- collection_with_validator.insert_one({ a: 1 })
3014
- end
3015
-
3016
- context 'when the document is valid' do
3017
-
3018
- let(:result) do
3019
- collection_with_validator.update_one(
3020
- { :a => { '$gt' => 0 } }, '$inc' => { :a => 1 } )
3021
- end
3022
-
3023
- it 'updates successfully' do
3024
- expect(result.modified_count).to eq(1)
3025
- end
3026
- end
3027
-
3028
- context 'when the document is invalid' do
3029
-
3030
- context 'when bypass_document_validation is not set' do
3031
-
3032
- let(:result2) do
3033
- collection_with_validator.update_one(
3034
- { :a => { '$gt' => 0 } }, '$unset' => { :a => '' })
3035
- end
3036
-
3037
- it 'raises OperationFailure' do
3038
- expect {
3039
- result2
3040
- }.to raise_exception(Mongo::Error::OperationFailure)
3041
- end
3042
- end
3043
-
3044
- context 'when bypass_document_validation is true' do
3045
-
3046
- let(:result3) do
3047
- collection_with_validator.update_one(
3048
- { :a => { '$gt' => 0 } }, { '$unset' => { :a => '' } },
3049
- :bypass_document_validation => true)
3050
- end
3051
-
3052
- it 'updates successfully' do
3053
- expect(result3.written_count).to eq(1)
3054
- end
3055
- end
3056
- end
3057
- end
3058
-
3059
- context 'when there is a collation specified' do
3060
-
3061
- let(:selector) do
3062
- { name: 'BANG' }
3063
- end
3064
-
3065
- let(:result) do
3066
- authorized_collection.update_one(selector, { '$set' => { other: 'doink' } }, options)
3067
- end
3068
-
3069
- before do
3070
- authorized_collection.insert_one(name: 'bang')
3071
- end
3072
-
3073
- let(:options) do
3074
- { collation: { locale: 'en_US', strength: 2 } }
3075
- end
3076
-
3077
- context 'when the server selected supports collations' do
3078
- min_server_fcv '3.4'
3079
-
3080
- it 'applies the collation' do
3081
- expect(result.written_count).to eq(1)
3082
- expect(authorized_collection.find(other: 'doink').count).to eq(1)
3083
- end
3084
-
3085
- context 'when unacknowledged writes is used' do
3086
-
3087
- let(:collection_with_unacknowledged_write_concern) do
3088
- authorized_collection.with(write: { w: 0 })
3089
- end
3090
-
3091
- let(:result) do
3092
- collection_with_unacknowledged_write_concern.update_one(selector, { '$set' => { other: 'doink' } }, options)
3093
- end
3094
-
3095
- it 'raises an exception' do
3096
- expect {
3097
- result
3098
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
3099
- end
3100
-
3101
- context 'when a String key is used' do
3102
-
3103
- let(:options) do
3104
- { 'collation' => { locale: 'en_US', strength: 2 } }
3105
- end
3106
-
3107
- it 'raises an exception' do
3108
- expect {
3109
- result
3110
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
3111
- end
3112
- end
3113
- end
3114
- end
3115
-
3116
- context 'when the server selected does not support collations' do
3117
- max_server_version '3.2'
3118
-
3119
- it 'raises an exception' do
3120
- expect {
3121
- result
3122
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
3123
- end
3124
-
3125
- context 'when a String key is used' do
3126
-
3127
- let(:options) do
3128
- { 'collation' => { locale: 'en_US', strength: 2 } }
3129
- end
3130
-
3131
- it 'raises an exception' do
3132
- expect {
3133
- result
3134
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
3135
- end
3136
- end
3137
- end
3138
- end
3139
-
3140
- context 'when a collation is not specified' do
3141
-
3142
- let(:selector) do
3143
- { name: 'BANG' }
3144
- end
3145
-
3146
- let(:result) do
3147
- authorized_collection.update_one(selector, { '$set' => { other: 'doink' } })
3148
- end
3149
-
3150
- before do
3151
- authorized_collection.insert_one(name: 'bang')
3152
- end
3153
-
3154
- it 'does not apply the collation' do
3155
- expect(result.written_count).to eq(0)
3156
- end
3157
- end
3158
-
3159
-
3160
- context 'when arrayFilters is provided' do
3161
-
3162
- let(:selector) do
3163
- { _id: 0}
3164
- end
3165
-
3166
- context 'when the server supports arrayFilters' do
3167
- min_server_fcv '3.6'
3168
-
3169
- before do
3170
- authorized_collection.insert_one(_id: 0, x: [{ y: 1 }, { y: 2 }, {y: 3 }])
3171
- end
3172
-
3173
- let(:result) do
3174
- authorized_collection.update_one(selector,
3175
- { '$set' => { 'x.$[i].y' => 5 } },
3176
- options)
3177
- end
3178
-
3179
- context 'when a Symbol key is used' do
3180
-
3181
- let(:options) do
3182
- { array_filters: [{ 'i.y' => 3 }] }
3183
- end
3184
-
3185
- it 'applies the arrayFilters' do
3186
- expect(result.matched_count).to eq(1)
3187
- expect(result.modified_count).to eq(1)
3188
- expect(authorized_collection.find(selector).first['x'].last['y']).to eq(5)
3189
- end
3190
- end
3191
-
3192
- context 'when a String key is used' do
3193
-
3194
- let(:options) do
3195
- { 'array_filters' => [{ 'i.y' => 3 }] }
3196
- end
3197
-
3198
- it 'applies the arrayFilters' do
3199
- expect(result.matched_count).to eq(1)
3200
- expect(result.modified_count).to eq(1)
3201
- expect(authorized_collection.find(selector).first['x'].last['y']).to eq(5)
3202
- end
3203
- end
3204
- end
3205
-
3206
- context 'when the server does not support arrayFilters' do
3207
- max_server_version '3.4'
3208
-
3209
- let(:result) do
3210
- authorized_collection.update_one(selector,
3211
- { '$set' => { 'x.$[i].y' => 5 } },
3212
- options)
3213
- end
3214
-
3215
- context 'when a Symbol key is used' do
3216
-
3217
- let(:options) do
3218
- { array_filters: [{ 'i.y' => 3 }] }
3219
- end
3220
-
3221
- it 'raises an exception' do
3222
- expect {
3223
- result
3224
- }.to raise_exception(Mongo::Error::UnsupportedArrayFilters)
3225
- end
3226
- end
3227
-
3228
- context 'when a String key is used' do
3229
-
3230
- let(:options) do
3231
- { 'array_filters' => [{ 'i.y' => 3 }] }
3232
- end
3233
-
3234
- it 'raises an exception' do
3235
- expect {
3236
- result
3237
- }.to raise_exception(Mongo::Error::UnsupportedArrayFilters)
3238
- end
3239
- end
3240
- end
3241
- end
3242
-
3243
- context 'when the documents are sent with OP_MSG' do
3244
- min_server_fcv '3.6'
3245
-
3246
- let(:documents) do
3247
- [{ '_id' => 1, 'name' => '1'*16777191 }, { '_id' => 'y' }]
3248
- end
3249
-
3250
- before do
3251
- authorized_collection.insert_many([{ field: 'test1' }, { field: 'test1' }])
3252
- client[TEST_COLL].update_one({ a: 1 }, {'$set' => { 'name' => '1'*16777149 }})
3253
- end
3254
-
3255
- let(:update_events) do
3256
- subscriber.started_events.select { |e| e.command_name == 'update' }
3257
- end
3258
-
3259
- it 'sends the documents in one OP_MSG' do
3260
- expect(update_events.size).to eq(1)
3261
- end
3262
- end
3263
-
3264
- context 'when a session is provided' do
3265
-
3266
- before do
3267
- authorized_collection.insert_many([{ field: 'test1' }, { field: 'test1' }])
3268
- end
3269
-
3270
- let(:session) do
3271
- authorized_client.start_session
3272
- end
3273
-
3274
- let(:operation) do
3275
- authorized_collection.update_one({ field: 'test' }, { '$set'=> { field: 'testing' } }, session: session)
3276
- end
3277
-
3278
- let(:failed_operation) do
3279
- authorized_collection.update_one({ '$._id' => 1 }, { '$set'=> { field: 'testing' } }, session: session)
3280
- end
3281
-
3282
- let(:client) do
3283
- authorized_client
3284
- end
3285
-
3286
- it_behaves_like 'an operation using a session'
3287
- it_behaves_like 'a failed operation using a session'
3288
- end
3289
-
3290
- context 'when unacknowledged writes is used with an explicit session' do
3291
-
3292
- let(:collection_with_unacknowledged_write_concern) do
3293
- authorized_collection.with(write: { w: 0 })
3294
- end
3295
-
3296
- let(:operation) do
3297
- collection_with_unacknowledged_write_concern.update_one({ a: 1 }, { '$set' => { x: 1 } }, session: session)
3298
- end
3299
-
3300
- it_behaves_like 'an explicit session with an unacknowledged write'
3301
- end
3302
-
3303
- context 'when unacknowledged writes is used with an implicit session' do
3304
-
3305
- let(:collection_with_unacknowledged_write_concern) do
3306
- client.with(write: { w: 0 })[TEST_COLL]
3307
- end
3308
-
3309
- let(:operation) do
3310
- collection_with_unacknowledged_write_concern.update_one({ a: 1 }, { '$set' => { x: 1 }})
3311
- end
3312
-
3313
- it_behaves_like 'an implicit session with an unacknowledged write'
3314
- end
3315
-
3316
- context 'when various options passed in' do
3317
- # w: 2 requires a replica set
3318
- require_topology :replica_set
3319
-
3320
- # https://jira.mongodb.org/browse/RUBY-2306
3321
- min_server_fcv '3.6'
3322
-
3323
- before do
3324
- collection.insert_many([{ field: 'test1' }, { field: 'test2' }], session: session)
3325
- end
3326
-
3327
- let(:session) do
3328
- authorized_client.start_session
3329
- end
3330
-
3331
- let(:collection) do
3332
- authorized_collection.with(write_concern: {w: 1})
3333
- end
3334
-
3335
- let(:events) do
3336
- subscriber.command_started_events('update')
3337
- end
3338
-
3339
- let!(:command) do
3340
- Utils.get_command_event(authorized_client, 'update') do |client|
3341
- collection.update_one(selector, { '$set'=> { field: 'testing' } }, session: session,
3342
- write_concern: {w: 2}, bypass_document_validation: true, :return_document => :after,
3343
- upsert: true)
3344
- end.command
3345
- end
3346
-
3347
- it 'updates one successfully with correct options sent to server' do
3348
- expect(events.length).to eq(1)
3349
- expect(command[:writeConcern]).to_not be_nil
3350
- expect(command[:writeConcern][:w]).to eq(2)
3351
- expect(collection.options[:write_concern]).to eq(w:1)
3352
- expect(command[:bypassDocumentValidation]).to be(true)
3353
- expect(command[:updates][0][:upsert]).to be(true)
3354
- end
3355
- end
3356
- end
3357
-
3358
- describe '#find_one_and_delete' do
3359
-
3360
- before do
3361
- authorized_collection.insert_many([{ field: 'test1' }])
3362
- end
3363
-
3364
- let(:selector) do
3365
- { field: 'test1' }
3366
- end
3367
-
3368
- context 'when a matching document is found' do
3369
-
3370
- context 'when a session is provided' do
3371
-
3372
- let(:operation) do
3373
- authorized_collection.find_one_and_delete(selector, session: session)
3374
- end
3375
-
3376
- let(:failed_operation) do
3377
- authorized_collection.find_one_and_delete({ '$._id' => 1 }, session: session)
3378
- end
3379
-
3380
- let(:session) do
3381
- authorized_client.start_session
3382
- end
3383
-
3384
- let(:client) do
3385
- authorized_client
3386
- end
3387
-
3388
- it_behaves_like 'an operation using a session'
3389
- it_behaves_like 'a failed operation using a session'
3390
- end
3391
-
3392
- context 'when no options are provided' do
3393
-
3394
- let!(:document) do
3395
- authorized_collection.find_one_and_delete(selector)
3396
- end
3397
-
3398
- it 'deletes the document from the database' do
3399
- expect(authorized_collection.find.to_a).to be_empty
3400
- end
3401
-
3402
- it 'returns the document' do
3403
- expect(document['field']).to eq('test1')
3404
- end
3405
- end
3406
-
3407
- context 'when a projection is provided' do
3408
-
3409
- let!(:document) do
3410
- authorized_collection.find_one_and_delete(selector, projection: { _id: 1 })
3411
- end
3412
-
3413
- it 'deletes the document from the database' do
3414
- expect(authorized_collection.find.to_a).to be_empty
3415
- end
3416
-
3417
- it 'returns the document with limited fields' do
3418
- expect(document['field']).to be_nil
3419
- expect(document['_id']).to_not be_nil
3420
- end
3421
- end
3422
-
3423
- context 'when a sort is provided' do
3424
-
3425
- let!(:document) do
3426
- authorized_collection.find_one_and_delete(selector, sort: { field: 1 })
3427
- end
3428
-
3429
- it 'deletes the document from the database' do
3430
- expect(authorized_collection.find.to_a).to be_empty
3431
- end
3432
-
3433
- it 'returns the document with limited fields' do
3434
- expect(document['field']).to eq('test1')
3435
- end
3436
- end
3437
-
3438
- context 'when max_time_ms is provided' do
3439
-
3440
- it 'includes the max_time_ms value in the command' do
3441
- expect {
3442
- authorized_collection.find_one_and_delete(selector, max_time_ms: 0.1)
3443
- }.to raise_error(Mongo::Error::OperationFailure)
3444
- end
3445
- end
3446
- end
3447
-
3448
- context 'when no matching document is found' do
3449
-
3450
- let(:selector) do
3451
- { field: 'test5' }
3452
- end
3453
-
3454
- let!(:document) do
3455
- authorized_collection.find_one_and_delete(selector)
3456
- end
3457
-
3458
- it 'returns nil' do
3459
- expect(document).to be_nil
3460
- end
3461
- end
3462
-
3463
- context 'when the operation fails' do
3464
-
3465
- let(:result) do
3466
- authorized_collection.find_one_and_delete(selector, max_time_ms: 0.1)
3467
- end
3468
-
3469
- it 'raises an OperationFailure' do
3470
- expect {
3471
- result
3472
- }.to raise_exception(Mongo::Error::OperationFailure)
3473
- end
3474
- end
3475
-
3476
- context 'when write_concern is provided' do
3477
- min_server_fcv '3.2'
3478
- require_topology :single
3479
-
3480
- it 'uses the write concern' do
3481
- expect {
3482
- authorized_collection.find_one_and_delete(selector,
3483
- write_concern: { w: 2 })
3484
- }.to raise_error(Mongo::Error::OperationFailure)
3485
- end
3486
- end
3487
-
3488
- context 'when the collection has a write concern' do
3489
- min_server_fcv '3.2'
3490
- require_topology :single
3491
-
3492
- let(:collection) do
3493
- authorized_collection.with(write: { w: 2 })
3494
- end
3495
-
3496
- it 'uses the write concern' do
3497
- expect {
3498
- collection.find_one_and_delete(selector,
3499
- write_concern: { w: 2 })
3500
- }.to raise_error(Mongo::Error::OperationFailure)
3501
- end
3502
- end
3503
-
3504
- context 'when collation is specified' do
3505
-
3506
- let(:selector) do
3507
- { name: 'BANG' }
3508
- end
3509
-
3510
- let(:result) do
3511
- authorized_collection.find_one_and_delete(selector, options)
3512
- end
3513
-
3514
- before do
3515
- authorized_collection.insert_one(name: 'bang')
3516
- end
3517
-
3518
- let(:options) do
3519
- { collation: { locale: 'en_US', strength: 2 } }
3520
- end
3521
-
3522
- context 'when the server selected supports collations' do
3523
- min_server_fcv '3.4'
3524
-
3525
- it 'applies the collation' do
3526
- expect(result['name']).to eq('bang')
3527
- expect(authorized_collection.find(name: 'bang').count).to eq(0)
3528
- end
3529
- end
3530
-
3531
- context 'when the server selected does not support collations' do
3532
- max_server_version '3.2'
3533
-
3534
- it 'raises an exception' do
3535
- expect {
3536
- result
3537
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
3538
- end
3539
-
3540
- context 'when a String key is used' do
3541
-
3542
- let(:options) do
3543
- { 'collation' => { locale: 'en_US', strength: 2 } }
3544
- end
3545
-
3546
- it 'raises an exception' do
3547
- expect {
3548
- result
3549
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
3550
- end
3551
- end
3552
- end
3553
- end
3554
-
3555
- context 'when collation is not specified' do
3556
-
3557
- let(:selector) do
3558
- { name: 'BANG' }
3559
- end
3560
-
3561
- let(:result) do
3562
- authorized_collection.find_one_and_delete(selector)
3563
- end
3564
-
3565
- before do
3566
- authorized_collection.insert_one(name: 'bang')
3567
- end
3568
-
3569
- it 'does not apply the collation' do
3570
- expect(result).to be_nil
3571
- end
3572
- end
3573
-
3574
- context 'when various options passed in' do
3575
- # w: 2 requires a replica set
3576
- require_topology :replica_set
3577
-
3578
- # https://jira.mongodb.org/browse/RUBY-2306
3579
- min_server_fcv '3.6'
3580
-
3581
- before do
3582
- authorized_collection.delete_many
3583
- authorized_collection.insert_many([{ name: 'test1' }, { name: 'test2' }])
3584
- end
3585
-
3586
- let(:collection) do
3587
- authorized_collection.with(write_concern: {w: 2})
3588
- end
3589
-
3590
- let(:session) do
3591
- authorized_client.start_session
3592
- end
3593
-
3594
- let!(:command) do
3595
- Utils.get_command_event(authorized_client, 'findAndModify') do |client|
3596
- collection.find_one_and_delete(selector, session: session, write_concern: {w: 2},
3597
- bypass_document_validation: true, max_time_ms: 300)
3598
- end.command
3599
- end
3600
-
3601
- let(:events) do
3602
- subscriber.command_started_events('findAndModify')
3603
- end
3604
-
3605
- it 'finds and deletes successfully with correct options sent to server' do
3606
- expect(events.length).to eq(1)
3607
- expect(command[:writeConcern]).to_not be_nil
3608
- expect(command[:writeConcern][:w]).to eq(2)
3609
- expect(command[:bypassDocumentValidation]).to eq(true)
3610
- expect(command[:maxTimeMS]).to eq(300)
3611
- end
3612
- end
3613
- end
3614
-
3615
- describe '#find_one_and_update' do
3616
-
3617
- let(:selector) do
3618
- { field: 'test1' }
3619
- end
3620
-
3621
- before do
3622
- authorized_collection.insert_many([{ field: 'test1' }])
3623
- end
3624
-
3625
- context 'when a matching document is found' do
3626
-
3627
- context 'when no options are provided' do
3628
-
3629
- let(:document) do
3630
- authorized_collection.find_one_and_update(selector, { '$set' => { field: 'testing' }})
3631
- end
3632
-
3633
- it 'returns the original document' do
3634
- expect(document['field']).to eq('test1')
3635
- end
3636
- end
3637
-
3638
- context 'when a session is provided' do
3639
-
3640
- let(:operation) do
3641
- authorized_collection.find_one_and_update(selector, { '$set' => { field: 'testing' }}, session: session)
3642
- end
3643
-
3644
- let(:failed_operation) do
3645
- authorized_collection.find_one_and_update({ '$._id' => 1 }, { '$set' => { field: 'testing' }}, session: session)
3646
- end
3647
-
3648
- let(:session) do
3649
- authorized_client.start_session
3650
- end
3651
-
3652
- let(:client) do
3653
- authorized_client
3654
- end
3655
-
3656
- it_behaves_like 'an operation using a session'
3657
- it_behaves_like 'a failed operation using a session'
3658
- end
3659
-
3660
- context 'when no options are provided' do
3661
-
3662
- let(:document) do
3663
- authorized_collection.find_one_and_update(selector, { '$set' => { field: 'testing' }})
3664
- end
3665
-
3666
- it 'returns the original document' do
3667
- expect(document['field']).to eq('test1')
3668
- end
3669
- end
3670
-
3671
- context 'when return_document options are provided' do
3672
-
3673
- context 'when return_document is :after' do
3674
-
3675
- let(:document) do
3676
- authorized_collection.find_one_and_update(selector, { '$set' => { field: 'testing' }}, :return_document => :after)
3677
- end
3678
-
3679
- it 'returns the new document' do
3680
- expect(document['field']).to eq('testing')
3681
- end
3682
- end
3683
-
3684
- context 'when return_document is :before' do
3685
-
3686
- let(:document) do
3687
- authorized_collection.find_one_and_update(selector, { '$set' => { field: 'testing' }}, :return_document => :before)
3688
- end
3689
-
3690
- it 'returns the original document' do
3691
- expect(document['field']).to eq('test1')
3692
- end
3693
- end
3694
- end
3695
-
3696
- context 'when a projection is provided' do
3697
-
3698
- let(:document) do
3699
- authorized_collection.find_one_and_update(selector, { '$set' => { field: 'testing' }}, projection: { _id: 1 })
3700
- end
3701
-
3702
- it 'returns the document with limited fields' do
3703
- expect(document['field']).to be_nil
3704
- expect(document['_id']).to_not be_nil
3705
- end
3706
- end
3707
-
3708
- context 'when a sort is provided' do
3709
-
3710
- let(:document) do
3711
- authorized_collection.find_one_and_update(selector, { '$set' => { field: 'testing' }}, sort: { field: 1 })
3712
- end
3713
-
3714
- it 'returns the original document' do
3715
- expect(document['field']).to eq('test1')
3716
- end
3717
- end
3718
- end
3719
-
3720
- context 'when max_time_ms is provided' do
3721
-
3722
- it 'includes the max_time_ms value in the command' do
3723
- expect {
3724
- authorized_collection.find_one_and_update(selector, { '$set' => { field: 'testing' }}, max_time_ms: 0.1)
3725
- }.to raise_error(Mongo::Error::OperationFailure)
3726
- end
3727
- end
3728
-
3729
- context 'when no matching document is found' do
3730
-
3731
- let(:selector) do
3732
- { field: 'test5' }
3733
- end
3734
-
3735
- let(:document) do
3736
- authorized_collection.find_one_and_update(selector, { '$set' => { field: 'testing' }})
3737
- end
3738
-
3739
- it 'returns nil' do
3740
- expect(document).to be_nil
3741
- end
3742
- end
3743
-
3744
- context 'when no matching document is found' do
3745
-
3746
- context 'when no upsert options are provided' do
3747
-
3748
- let(:selector) do
3749
- { field: 'test5' }
3750
- end
3751
-
3752
- let(:document) do
3753
- authorized_collection.find_one_and_update(selector, { '$set' => { field: 'testing' }})
3754
- end
3755
-
3756
- it 'returns nil' do
3757
- expect(document).to be_nil
3758
- end
3759
- end
3760
-
3761
- context 'when upsert options are provided' do
3762
-
3763
- let(:selector) do
3764
- { field: 'test5' }
3765
- end
3766
-
3767
- let(:document) do
3768
- authorized_collection.find_one_and_update(selector, { '$set' => { field: 'testing' }}, :upsert => true, :return_document => :after)
3769
- end
3770
-
3771
- it 'returns the new document' do
3772
- expect(document['field']).to eq('testing')
3773
- end
3774
- end
3775
- end
3776
-
3777
- context 'when the operation fails' do
3778
-
3779
- let(:result) do
3780
- authorized_collection.find_one_and_update(selector, { '$set' => { field: 'testing' }}, max_time_ms: 0.1)
3781
- end
3782
-
3783
- it 'raises an OperationFailure' do
3784
- expect {
3785
- result
3786
- }.to raise_exception(Mongo::Error::OperationFailure)
3787
- end
3788
- end
3789
-
3790
- context 'when collection has a validator' do
3791
- min_server_fcv '3.2'
3792
-
3793
- around(:each) do |spec|
3794
- authorized_client[:validating].drop
3795
- authorized_client[:validating,
3796
- :validator => { :a => { '$exists' => true } }].tap do |c|
3797
- c.create
3798
- end
3799
- spec.run
3800
- collection_with_validator.drop
3801
- end
3802
-
3803
- before do
3804
- collection_with_validator.insert_one({ a: 1 })
3805
- end
3806
-
3807
- context 'when the document is valid' do
3808
-
3809
- let(:result) do
3810
- collection_with_validator.find_one_and_update(
3811
- { a: 1 }, { '$inc' => { :a => 1 } }, :return_document => :after)
3812
- end
3813
-
3814
- it 'updates successfully' do
3815
- expect(result['a']).to eq(2)
3816
- end
3817
- end
3818
-
3819
- context 'when the document is invalid' do
3820
-
3821
- context 'when bypass_document_validation is not set' do
3822
-
3823
- let(:result2) do
3824
- collection_with_validator.find_one_and_update(
3825
- { a: 1 }, { '$unset' => { :a => '' } }, :return_document => :after)
3826
- end
3827
-
3828
- it 'raises OperationFailure' do
3829
- expect {
3830
- result2
3831
- }.to raise_exception(Mongo::Error::OperationFailure)
3832
- end
3833
- end
3834
-
3835
- context 'when bypass_document_validation is true' do
3836
-
3837
- let(:result3) do
3838
- collection_with_validator.find_one_and_update(
3839
- { a: 1 }, { '$unset' => { :a => '' } },
3840
- :bypass_document_validation => true,
3841
- :return_document => :after)
3842
- end
3843
-
3844
- it 'updates successfully' do
3845
- expect(result3['a']).to be_nil
3846
- end
3847
- end
3848
- end
3849
- end
3850
-
3851
- context 'when write_concern is provided' do
3852
- min_server_fcv '3.2'
3853
- require_topology :single
3854
-
3855
- it 'uses the write concern' do
3856
- expect {
3857
- authorized_collection.find_one_and_update(selector,
3858
- { '$set' => { field: 'testing' }},
3859
- write_concern: { w: 2 })
3860
- }.to raise_error(Mongo::Error::OperationFailure)
3861
- end
3862
- end
3863
-
3864
- context 'when the collection has a write concern' do
3865
- min_server_fcv '3.2'
3866
- require_topology :single
3867
-
3868
- let(:collection) do
3869
- authorized_collection.with(write: { w: 2 })
3870
- end
3871
-
3872
- it 'uses the write concern' do
3873
- expect {
3874
- collection.find_one_and_update(selector,
3875
- { '$set' => { field: 'testing' }},
3876
- write_concern: { w: 2 })
3877
- }.to raise_error(Mongo::Error::OperationFailure)
3878
- end
3879
- end
3880
-
3881
- context 'when a collation is specified' do
3882
-
3883
- let(:selector) do
3884
- { name: 'BANG' }
3885
- end
3886
-
3887
- let(:result) do
3888
- authorized_collection.find_one_and_update(selector,
3889
- { '$set' => { other: 'doink' } },
3890
- options)
3891
- end
3892
-
3893
- before do
3894
- authorized_collection.insert_one(name: 'bang')
3895
- end
3896
-
3897
- let(:options) do
3898
- { collation: { locale: 'en_US', strength: 2 } }
3899
- end
3900
-
3901
- context 'when the server selected supports collations' do
3902
- min_server_fcv '3.4'
3903
-
3904
- it 'applies the collation' do
3905
- expect(result['name']).to eq('bang')
3906
- expect(authorized_collection.find({ name: 'bang' }, limit: -1).first['other']).to eq('doink')
3907
- end
3908
- end
3909
-
3910
- context 'when the server selected does not support collations' do
3911
- max_server_version '3.2'
3912
-
3913
- it 'raises an exception' do
3914
- expect {
3915
- result
3916
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
3917
- end
3918
-
3919
- context 'when a String key is used' do
3920
-
3921
- let(:options) do
3922
- { 'collation' => { locale: 'en_US', strength: 2 } }
3923
- end
3924
-
3925
- it 'raises an exception' do
3926
- expect {
3927
- result
3928
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
3929
- end
3930
- end
3931
- end
3932
- end
3933
-
3934
- context 'when there is no collation specified' do
3935
-
3936
- let(:selector) do
3937
- { name: 'BANG' }
3938
- end
3939
-
3940
- let(:result) do
3941
- authorized_collection.find_one_and_update(selector, { '$set' => { other: 'doink' } })
3942
- end
3943
-
3944
- before do
3945
- authorized_collection.insert_one(name: 'bang')
3946
- end
3947
-
3948
- it 'does not apply the collation' do
3949
- expect(result).to be_nil
3950
- end
3951
- end
3952
-
3953
- context 'when arrayFilters is provided' do
3954
-
3955
- let(:selector) do
3956
- { _id: 0 }
3957
- end
3958
-
3959
- context 'when the server supports arrayFilters' do
3960
- min_server_fcv '3.6'
3961
-
3962
- before do
3963
- authorized_collection.insert_one(_id: 0, x: [{ y: 1 }, { y: 2 }, { y: 3 }])
3964
- end
3965
-
3966
- let(:result) do
3967
- authorized_collection.find_one_and_update(selector,
3968
- { '$set' => { 'x.$[i].y' => 5 } },
3969
- options)
3970
- end
3971
-
3972
- context 'when a Symbol key is used' do
3973
-
3974
- let(:options) do
3975
- { array_filters: [{ 'i.y' => 3 }] }
3976
- end
3977
-
3978
-
3979
- it 'applies the arrayFilters' do
3980
- expect(result['x']).to eq([{ 'y' => 1 }, { 'y' => 2 }, { 'y' => 3 }])
3981
- expect(authorized_collection.find(selector).first['x'].last['y']).to eq(5)
3982
- end
3983
- end
3984
-
3985
- context 'when a String key is used' do
3986
-
3987
- let(:options) do
3988
- { 'array_filters' => [{ 'i.y' => 3 }] }
3989
- end
3990
-
3991
- it 'applies the arrayFilters' do
3992
- expect(result['x']).to eq([{ 'y' => 1 }, { 'y' => 2 }, { 'y' => 3 }])
3993
- expect(authorized_collection.find(selector).first['x'].last['y']).to eq(5)
3994
- end
3995
- end
3996
- end
3997
-
3998
- context 'when the server selected does not support arrayFilters' do
3999
- max_server_version '3.4'
4000
-
4001
- let(:result) do
4002
- authorized_collection.find_one_and_update(selector,
4003
- { '$set' => { 'x.$[i].y' => 5 } },
4004
- options)
4005
- end
4006
-
4007
- context 'when a Symbol key is used' do
4008
-
4009
- let(:options) do
4010
- { array_filters: [{ 'i.y' => 3 }] }
4011
- end
4012
-
4013
- it 'raises an exception' do
4014
- expect {
4015
- result
4016
- }.to raise_exception(Mongo::Error::UnsupportedArrayFilters)
4017
- end
4018
- end
4019
-
4020
- context 'when a String key is used' do
4021
-
4022
- let(:options) do
4023
- { 'array_filters' => [{ 'i.y' => 3 }] }
4024
- end
4025
-
4026
- it 'raises an exception' do
4027
- expect {
4028
- result
4029
- }.to raise_exception(Mongo::Error::UnsupportedArrayFilters)
4030
- end
4031
- end
4032
- end
4033
- end
4034
-
4035
- context 'when various options passed in' do
4036
- # w: 2 requires a replica set
4037
- require_topology :replica_set
4038
-
4039
- # https://jira.mongodb.org/browse/RUBY-2306
4040
- min_server_fcv '3.6'
4041
-
4042
- let(:session) do
4043
- authorized_client.start_session
4044
- end
4045
-
4046
- let(:events) do
4047
- subscriber.command_started_events('findAndModify')
4048
- end
4049
-
4050
- let(:collection) do
4051
- authorized_collection.with(write_concern: {w: 2})
4052
- end
4053
-
4054
- let(:selector) do
4055
- {field: 'test1'}
4056
- end
4057
-
4058
- before do
4059
- collection.insert_one({field: 'test1'}, session: session)
4060
- end
4061
-
4062
- let!(:command) do
4063
- Utils.get_command_event(authorized_client, 'findAndModify') do |client|
4064
- collection.find_one_and_update(selector, { '$set' => {field: 'testing'}},
4065
- :return_document => :after, write_concern: {w: 1}, upsert: true,
4066
- bypass_document_validation: true, max_time_ms: 100, session: session)
4067
- end.command
4068
- end
4069
-
4070
- it 'find and updates successfully with correct options sent to server' do
4071
- expect(events.length).to eq(1)
4072
- expect(command[:writeConcern]).to_not be_nil
4073
- expect(command[:writeConcern][:w]).to eq(1)
4074
- expect(command[:upsert]).to eq(true)
4075
- expect(command[:bypassDocumentValidation]).to be(true)
4076
- expect(command[:maxTimeMS]).to eq(100)
4077
- end
4078
- end
4079
- end
4080
-
4081
- describe '#find_one_and_replace' do
4082
-
4083
- before do
4084
- authorized_collection.insert_many([{ field: 'test1', other: 'sth' }])
4085
- end
4086
-
4087
- let(:selector) do
4088
- { field: 'test1' }
4089
- end
4090
-
4091
- context 'when a matching document is found' do
4092
-
4093
- context 'when no options are provided' do
4094
-
4095
- let(:document) do
4096
- authorized_collection.find_one_and_replace(selector, { field: 'testing' })
4097
- end
4098
-
4099
- it 'returns the original document' do
4100
- expect(document['field']).to eq('test1')
4101
- end
4102
- end
4103
-
4104
- context 'when a session is provided' do
4105
-
4106
- let(:operation) do
4107
- authorized_collection.find_one_and_replace(selector, { field: 'testing' }, session: session)
4108
- end
4109
-
4110
- let(:failed_operation) do
4111
- authorized_collection.find_one_and_replace({ '$._id' => 1}, { field: 'testing' }, session: session)
4112
- end
4113
-
4114
- let(:session) do
4115
- authorized_client.start_session
4116
- end
4117
-
4118
- let(:client) do
4119
- authorized_client
4120
- end
4121
-
4122
- it_behaves_like 'an operation using a session'
4123
- it_behaves_like 'a failed operation using a session'
4124
- end
4125
-
4126
- context 'when return_document options are provided' do
4127
-
4128
- context 'when return_document is :after' do
4129
-
4130
- let(:document) do
4131
- authorized_collection.find_one_and_replace(selector, { field: 'testing' }, :return_document => :after)
4132
- end
4133
-
4134
- it 'returns the new document' do
4135
- expect(document['field']).to eq('testing')
4136
- end
4137
- end
4138
-
4139
- context 'when return_document is :before' do
4140
-
4141
- let(:document) do
4142
- authorized_collection.find_one_and_replace(selector, { field: 'testing' }, :return_document => :before)
4143
- end
4144
-
4145
- it 'returns the original document' do
4146
- expect(document['field']).to eq('test1')
4147
- end
4148
- end
4149
- end
4150
-
4151
- context 'when a projection is provided' do
4152
-
4153
- let(:document) do
4154
- authorized_collection.find_one_and_replace(selector, { field: 'testing' }, projection: { _id: 1 })
4155
- end
4156
-
4157
- it 'returns the document with limited fields' do
4158
- expect(document['field']).to be_nil
4159
- expect(document['_id']).to_not be_nil
4160
- end
4161
- end
4162
-
4163
- context 'when a sort is provided' do
4164
-
4165
- let(:document) do
4166
- authorized_collection.find_one_and_replace(selector, { field: 'testing' }, :sort => { field: 1 })
4167
- end
4168
-
4169
- it 'returns the original document' do
4170
- expect(document['field']).to eq('test1')
4171
- end
4172
- end
4173
- end
4174
-
4175
- context 'when no matching document is found' do
4176
-
4177
- context 'when no upsert options are provided' do
4178
-
4179
- let(:selector) do
4180
- { field: 'test5' }
4181
- end
4182
-
4183
- let(:document) do
4184
- authorized_collection.find_one_and_replace(selector, { field: 'testing' })
4185
- end
4186
-
4187
- it 'returns nil' do
4188
- expect(document).to be_nil
4189
- end
4190
- end
4191
-
4192
- context 'when upsert options are provided' do
4193
-
4194
- let(:selector) do
4195
- { field: 'test5' }
4196
- end
4197
-
4198
- let(:document) do
4199
- authorized_collection.find_one_and_replace(selector, { field: 'testing' }, :upsert => true, :return_document => :after)
4200
- end
4201
-
4202
- it 'returns the new document' do
4203
- expect(document['field']).to eq('testing')
4204
- end
4205
- end
4206
- end
4207
-
4208
- context 'when max_time_ms is provided' do
4209
-
4210
- it 'includes the max_time_ms value in the command' do
4211
- expect {
4212
- authorized_collection.find_one_and_replace(selector, { field: 'testing' }, max_time_ms: 0.1)
4213
- }.to raise_error(Mongo::Error::OperationFailure)
4214
- end
4215
- end
4216
-
4217
- context 'when the operation fails' do
4218
-
4219
- let(:result) do
4220
- authorized_collection.find_one_and_replace(selector, { field: 'testing' }, max_time_ms: 0.1)
4221
- end
4222
-
4223
- it 'raises an OperationFailure' do
4224
- expect {
4225
- result
4226
- }.to raise_exception(Mongo::Error::OperationFailure)
4227
- end
4228
- end
4229
-
4230
- context 'when collection has a validator' do
4231
- min_server_fcv '3.2'
4232
-
4233
- around(:each) do |spec|
4234
- authorized_client[:validating].drop
4235
- authorized_client[:validating,
4236
- :validator => { :a => { '$exists' => true } }].tap do |c|
4237
- c.create
4238
- end
4239
- spec.run
4240
- collection_with_validator.drop
4241
- end
4242
-
4243
- before do
4244
- collection_with_validator.insert_one({ a: 1 })
4245
- end
4246
-
4247
- context 'when the document is valid' do
4248
-
4249
- let(:result) do
4250
- collection_with_validator.find_one_and_replace(
4251
- { a: 1 }, { a: 5 }, :return_document => :after)
4252
- end
4253
-
4254
- it 'replaces successfully when document is valid' do
4255
- expect(result[:a]).to eq(5)
4256
- end
4257
- end
4258
-
4259
- context 'when the document is invalid' do
4260
-
4261
- context 'when bypass_document_validation is not set' do
4262
-
4263
- let(:result2) do
4264
- collection_with_validator.find_one_and_replace(
4265
- { a: 1 }, { x: 5 }, :return_document => :after)
4266
- end
4267
-
4268
- it 'raises OperationFailure' do
4269
- expect {
4270
- result2
4271
- }.to raise_exception(Mongo::Error::OperationFailure)
4272
- end
4273
- end
4274
-
4275
- context 'when bypass_document_validation is true' do
4276
-
4277
- let(:result3) do
4278
- collection_with_validator.find_one_and_replace(
4279
- { a: 1 }, { x: 1 }, :bypass_document_validation => true,
4280
- :return_document => :after)
4281
- end
4282
-
4283
- it 'replaces successfully' do
4284
- expect(result3[:x]).to eq(1)
4285
- expect(result3[:a]).to be_nil
4286
- end
4287
- end
4288
- end
4289
- end
4290
-
4291
- context 'when write_concern is provided' do
4292
- min_server_fcv '3.2'
4293
- require_topology :single
4294
-
4295
- it 'uses the write concern' do
4296
- expect {
4297
- authorized_collection.find_one_and_replace(selector,
4298
- { field: 'testing' },
4299
- write_concern: { w: 2 })
4300
- }.to raise_error(Mongo::Error::OperationFailure)
4301
- end
4302
- end
4303
-
4304
- context 'when the collection has a write concern' do
4305
- min_server_fcv '3.2'
4306
- require_topology :single
4307
-
4308
- let(:collection) do
4309
- authorized_collection.with(write: { w: 2 })
4310
- end
4311
-
4312
- it 'uses the write concern' do
4313
- expect {
4314
- collection.find_one_and_replace(selector,
4315
- { field: 'testing' },
4316
- write_concern: { w: 2 })
4317
- }.to raise_error(Mongo::Error::OperationFailure)
4318
- end
4319
- end
4320
-
4321
- context 'when collation is provided' do
4322
-
4323
- let(:selector) do
4324
- { name: 'BANG' }
4325
- end
4326
-
4327
- let(:result) do
4328
- authorized_collection.find_one_and_replace(selector,
4329
- { name: 'doink' },
4330
- options)
4331
- end
4332
-
4333
- before do
4334
- authorized_collection.insert_one(name: 'bang')
4335
- end
4336
-
4337
- let(:options) do
4338
- { collation: { locale: 'en_US', strength: 2 } }
4339
- end
4340
-
4341
- context 'when the server selected supports collations' do
4342
- min_server_fcv '3.4'
4343
-
4344
- it 'applies the collation' do
4345
- expect(result['name']).to eq('bang')
4346
- expect(authorized_collection.find(name: 'doink').count).to eq(1)
4347
- end
4348
- end
4349
-
4350
- context 'when the server selected does not support collations' do
4351
- max_server_version '3.2'
4352
-
4353
- it 'raises an exception' do
4354
- expect {
4355
- result
4356
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
4357
- end
4358
-
4359
- context 'when a String key is used' do
4360
-
4361
- let(:options) do
4362
- { 'collation' => { locale: 'en_US', strength: 2 } }
4363
- end
4364
-
4365
- it 'raises an exception' do
4366
- expect {
4367
- result
4368
- }.to raise_exception(Mongo::Error::UnsupportedCollation)
4369
- end
4370
- end
4371
- end
4372
- end
4373
-
4374
- context 'when collation is not specified' do
4375
-
4376
- let(:selector) do
4377
- { name: 'BANG' }
4378
- end
4379
-
4380
- let(:result) do
4381
- authorized_collection.find_one_and_replace(selector, { name: 'doink' })
4382
- end
4383
-
4384
- before do
4385
- authorized_collection.insert_one(name: 'bang')
4386
- end
4387
-
4388
- it 'does not apply the collation' do
4389
- expect(result).to be_nil
4390
- end
4391
- end
4392
-
4393
- context 'when various options passed in' do
4394
- # https://jira.mongodb.org/browse/RUBY-2306
4395
- min_server_fcv '3.6'
4396
-
4397
- before do
4398
- authorized_collection.insert_one({field: 'test1'})
4399
- end
4400
-
4401
- let(:session) do
4402
- authorized_client.start_session
4403
- end
4404
-
4405
- let(:events) do
4406
- subscriber.command_started_events('findAndModify')
4407
- end
4408
-
4409
- let(:collection) do
4410
- authorized_collection.with(write_concern: { w: 2 })
4411
- end
4412
-
4413
- let!(:command) do
4414
- Utils.get_command_event(authorized_client, 'findAndModify') do |client|
4415
- collection.find_one_and_replace(selector, { '$set' => {field: 'test5'}},
4416
- :return_document => :after, write_concern: {w: 1}, session: session,
4417
- upsert: true, bypass_document_validation: false, max_time_ms: 200)
4418
- end.command
4419
- end
4420
-
4421
- it 'find and replaces successfully with correct options sent to server' do
4422
- expect(events.length).to eq(1)
4423
- expect(command[:writeConcern]).to_not be_nil
4424
- expect(command[:writeConcern][:w]).to eq(1)
4425
- expect(command[:upsert]).to be(true)
4426
- expect(command[:bypassDocumentValidation]).to be false
4427
- expect(command[:maxTimeMS]).to eq(200)
4428
- end
4429
- end
4430
- end
4431
-
4432
- context 'when unacknowledged writes is used on find_one_and_update' do
4433
-
4434
- let(:selector) do
4435
- { name: 'BANG' }
4436
- end
4437
-
4438
- let(:collection_with_unacknowledged_write_concern) do
4439
- authorized_collection.with(write: { w: 0 })
4440
- end
4441
-
4442
- let(:result) do
4443
- collection_with_unacknowledged_write_concern.find_one_and_update(selector,
4444
- { '$set' => { field: 'testing' }},
4445
- write_concern: { w: 0 })
4446
- end
4447
-
4448
- it 'does not raise an exception' do
4449
- expect(result).to be_nil
4450
- end
4451
- end
4452
-
4453
- context "when creating collection with view_on and pipeline" do
4454
- before do
4455
- authorized_client["my_view"].drop
4456
- authorized_collection.insert_one({ bar: "here!" })
4457
- authorized_client["my_view",
4458
- view_on: authorized_collection.name,
4459
- pipeline: [ { :'$project' => { "baz": "$bar" } } ]
4460
- ].create
4461
- end
4462
-
4463
- it "the view has a document" do
4464
- expect(authorized_client["my_view"].find.to_a.length).to eq(1)
4465
- end
4466
-
4467
- it "applies the pipeline" do
4468
- expect(authorized_client["my_view"].find.first).to have_key("baz")
4469
- expect(authorized_client["my_view"].find.first["baz"]).to eq("here!")
4470
- end
4471
- end
4472
- end