mongo 2.10.5 → 2.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CONTRIBUTING.md +8 -36
- data/LICENSE +1 -1
- data/README.md +57 -53
- data/Rakefile +76 -16
- data/lib/mongo/active_support.rb +4 -1
- data/lib/mongo/address/ipv4.rb +35 -5
- data/lib/mongo/address/ipv6.rb +35 -5
- data/lib/mongo/address/unix.rb +6 -3
- data/lib/mongo/address/validator.rb +102 -0
- data/lib/mongo/address.rb +121 -46
- data/lib/mongo/auth/aws/conversation.rb +128 -0
- data/lib/mongo/auth/aws/credentials_retriever.rb +222 -0
- data/lib/mongo/auth/aws/request.rb +286 -0
- data/lib/mongo/auth/aws.rb +40 -0
- data/lib/mongo/auth/base.rb +138 -0
- data/lib/mongo/auth/conversation_base.rb +87 -0
- data/lib/mongo/auth/cr/conversation.rb +24 -89
- data/lib/mongo/auth/cr.rb +13 -36
- data/lib/mongo/auth/credential_cache.rb +54 -0
- data/lib/mongo/auth/gssapi/conversation.rb +100 -0
- data/lib/mongo/auth/gssapi.rb +41 -0
- data/lib/mongo/auth/ldap/conversation.rb +12 -63
- data/lib/mongo/auth/ldap.rb +13 -34
- data/lib/mongo/auth/roles.rb +4 -1
- data/lib/mongo/auth/sasl_conversation_base.rb +102 -0
- data/lib/mongo/auth/scram/conversation.rb +16 -491
- data/lib/mongo/auth/scram.rb +43 -51
- data/lib/mongo/auth/scram256/conversation.rb +66 -0
- data/lib/mongo/auth/scram256.rb +34 -0
- data/lib/mongo/auth/scram_conversation_base.rb +378 -0
- data/lib/mongo/auth/stringprep/profiles/sasl.rb +5 -1
- data/lib/mongo/auth/stringprep/tables.rb +5 -1
- data/lib/mongo/auth/stringprep/unicode_normalize/normalize.rb +3 -2
- data/lib/mongo/auth/stringprep/unicode_normalize/tables.rb +2 -1
- data/lib/mongo/auth/stringprep.rb +9 -5
- data/lib/mongo/auth/user/view.rb +30 -14
- data/lib/mongo/auth/user.rb +17 -8
- data/lib/mongo/auth/x509/conversation.rb +26 -62
- data/lib/mongo/auth/x509.rb +29 -33
- data/lib/mongo/auth.rb +84 -23
- data/lib/mongo/background_thread.rb +173 -0
- data/lib/mongo/bson.rb +4 -1
- data/lib/mongo/bulk_write/combineable.rb +23 -8
- data/lib/mongo/bulk_write/ordered_combiner.rb +4 -1
- data/lib/mongo/bulk_write/result.rb +4 -1
- data/lib/mongo/bulk_write/result_combiner.rb +4 -1
- data/lib/mongo/bulk_write/transformable.rb +12 -10
- data/lib/mongo/bulk_write/unordered_combiner.rb +4 -1
- data/lib/mongo/bulk_write/validatable.rb +8 -1
- data/lib/mongo/bulk_write.rb +85 -26
- data/lib/mongo/caching_cursor.rb +77 -0
- data/lib/mongo/client.rb +584 -66
- data/lib/mongo/client_encryption.rb +106 -0
- data/lib/mongo/cluster/periodic_executor.rb +35 -44
- data/lib/mongo/cluster/reapers/cursor_reaper.rb +26 -7
- data/lib/mongo/cluster/reapers/socket_reaper.rb +4 -1
- data/lib/mongo/cluster/sdam_flow.rb +165 -26
- data/lib/mongo/cluster/topology/base.rb +4 -1
- data/lib/mongo/cluster/topology/no_replica_set_options.rb +4 -1
- data/lib/mongo/cluster/topology/replica_set_no_primary.rb +7 -3
- data/lib/mongo/cluster/topology/replica_set_with_primary.rb +4 -1
- data/lib/mongo/cluster/topology/sharded.rb +5 -2
- data/lib/mongo/cluster/topology/single.rb +6 -3
- data/lib/mongo/cluster/topology/unknown.rb +4 -1
- data/lib/mongo/cluster/topology.rb +22 -2
- data/lib/mongo/cluster.rb +426 -150
- data/lib/mongo/cluster_time.rb +4 -1
- data/lib/mongo/collection/view/aggregation.rb +35 -8
- data/lib/mongo/collection/view/builder/aggregation.rb +4 -1
- data/lib/mongo/collection/view/builder/find_command.rb +50 -19
- data/lib/mongo/collection/view/builder/flags.rb +4 -1
- data/lib/mongo/collection/view/builder/map_reduce.rb +4 -1
- data/lib/mongo/collection/view/builder/modifiers.rb +4 -1
- data/lib/mongo/collection/view/builder/op_query.rb +4 -1
- data/lib/mongo/collection/view/builder.rb +4 -1
- data/lib/mongo/collection/view/change_stream/retryable.rb +4 -1
- data/lib/mongo/collection/view/change_stream.rb +23 -10
- data/lib/mongo/collection/view/explainable.rb +31 -9
- data/lib/mongo/collection/view/immutable.rb +4 -1
- data/lib/mongo/collection/view/iterable.rb +106 -18
- data/lib/mongo/collection/view/map_reduce.rb +12 -6
- data/lib/mongo/collection/view/readable.rb +81 -25
- data/lib/mongo/collection/view/writable.rb +127 -28
- data/lib/mongo/collection/view.rb +33 -22
- data/lib/mongo/collection.rb +129 -41
- data/lib/mongo/crypt/auto_decryption_context.rb +43 -0
- data/lib/mongo/crypt/auto_encrypter.rb +182 -0
- data/lib/mongo/crypt/auto_encryption_context.rb +47 -0
- data/lib/mongo/crypt/binary.rb +158 -0
- data/lib/mongo/crypt/binding.rb +1232 -0
- data/lib/mongo/crypt/context.rb +138 -0
- data/lib/mongo/crypt/data_key_context.rb +165 -0
- data/lib/mongo/crypt/encryption_io.rb +309 -0
- data/lib/mongo/crypt/explicit_decryption_context.rb +43 -0
- data/lib/mongo/crypt/explicit_encrypter.rb +120 -0
- data/lib/mongo/crypt/explicit_encryption_context.rb +92 -0
- data/lib/mongo/crypt/handle.rb +318 -0
- data/lib/mongo/crypt/hooks.rb +93 -0
- data/lib/mongo/crypt/kms_context.rb +70 -0
- data/lib/mongo/crypt/status.rb +134 -0
- data/lib/mongo/crypt.rb +36 -0
- data/lib/mongo/cursor/builder/get_more_command.rb +4 -1
- data/lib/mongo/cursor/builder/kill_cursors_command.rb +4 -1
- data/lib/mongo/cursor/builder/op_get_more.rb +4 -1
- data/lib/mongo/cursor/builder/op_kill_cursors.rb +4 -1
- data/lib/mongo/cursor/builder.rb +4 -1
- data/lib/mongo/cursor.rb +97 -38
- data/lib/mongo/database/view.rb +34 -7
- data/lib/mongo/database.rb +87 -14
- data/lib/mongo/dbref.rb +13 -3
- data/lib/mongo/distinguishing_semaphore.rb +58 -0
- data/lib/mongo/error/auth_error.rb +5 -2
- data/lib/mongo/error/bulk_write_error.rb +34 -15
- data/lib/mongo/error/change_stream_resumable.rb +4 -1
- data/lib/mongo/error/closed_stream.rb +4 -1
- data/lib/mongo/error/connection_check_out_timeout.rb +11 -9
- data/lib/mongo/error/connection_perished.rb +26 -0
- data/lib/mongo/error/credential_check_error.rb +29 -0
- data/lib/mongo/error/crypt_error.rb +34 -0
- data/lib/mongo/error/extra_file_chunk.rb +4 -1
- data/lib/mongo/error/{failed_stringprep_validation.rb → failed_string_prep_validation.rb} +3 -0
- data/lib/mongo/error/file_not_found.rb +4 -1
- data/lib/mongo/error/handshake_error.rb +4 -1
- data/lib/mongo/error/insufficient_iteration_count.rb +4 -1
- data/lib/mongo/error/internal_driver_error.rb +25 -0
- data/lib/mongo/error/invalid_address.rb +27 -0
- data/lib/mongo/error/invalid_application_name.rb +4 -1
- data/lib/mongo/error/invalid_bulk_operation.rb +4 -1
- data/lib/mongo/error/invalid_bulk_operation_type.rb +4 -1
- data/lib/mongo/error/invalid_collection_name.rb +4 -1
- data/lib/mongo/error/invalid_cursor_operation.rb +30 -0
- data/lib/mongo/error/invalid_database_name.rb +4 -1
- data/lib/mongo/error/invalid_document.rb +4 -1
- data/lib/mongo/error/invalid_file.rb +4 -1
- data/lib/mongo/error/invalid_file_revision.rb +4 -1
- data/lib/mongo/error/invalid_min_pool_size.rb +4 -1
- data/lib/mongo/error/invalid_nonce.rb +5 -2
- data/lib/mongo/error/invalid_read_concern.rb +31 -0
- data/lib/mongo/error/invalid_read_option.rb +4 -1
- data/lib/mongo/error/invalid_replacement_document.rb +4 -1
- data/lib/mongo/error/invalid_server_auth_host.rb +25 -0
- data/lib/mongo/error/invalid_server_auth_response.rb +26 -0
- data/lib/mongo/error/invalid_server_preference.rb +9 -1
- data/lib/mongo/error/invalid_session.rb +6 -2
- data/lib/mongo/error/invalid_signature.rb +4 -1
- data/lib/mongo/error/invalid_transaction_operation.rb +4 -1
- data/lib/mongo/error/invalid_txt_record.rb +4 -1
- data/lib/mongo/error/invalid_update_document.rb +4 -1
- data/lib/mongo/error/invalid_uri.rb +4 -1
- data/lib/mongo/error/invalid_write_concern.rb +4 -1
- data/{spec/support/crud/context.rb → lib/mongo/error/kms_error.rb} +8 -6
- data/lib/mongo/error/lint_error.rb +4 -1
- data/lib/mongo/error/max_bson_size.rb +18 -4
- data/lib/mongo/error/max_message_size.rb +4 -1
- data/lib/mongo/error/mismatched_domain.rb +4 -1
- data/lib/mongo/error/missing_file_chunk.rb +4 -1
- data/lib/mongo/error/missing_password.rb +4 -1
- data/lib/mongo/error/missing_resume_token.rb +4 -1
- data/lib/mongo/error/missing_scram_server_signature.rb +30 -0
- data/lib/mongo/error/mongocryptd_spawn_error.rb +25 -0
- data/lib/mongo/error/multi_index_drop.rb +4 -1
- data/lib/mongo/error/need_primary_server.rb +4 -1
- data/lib/mongo/error/no_server_available.rb +12 -4
- data/lib/mongo/error/no_srv_records.rb +4 -1
- data/lib/mongo/error/notable.rb +22 -19
- data/lib/mongo/error/operation_failure.rb +92 -50
- data/lib/mongo/error/parser.rb +85 -18
- data/lib/mongo/error/pool_closed_error.rb +15 -5
- data/lib/mongo/error/raise_original_error.rb +32 -0
- data/lib/mongo/error/sdam_error_detection.rb +16 -5
- data/lib/mongo/error/server_api_conflict.rb +26 -0
- data/lib/mongo/error/server_api_not_supported.rb +27 -0
- data/lib/mongo/error/server_certificate_revoked.rb +25 -0
- data/lib/mongo/error/session_ended.rb +4 -1
- data/lib/mongo/error/sessions_not_supported.rb +38 -0
- data/lib/mongo/error/socket_error.rb +4 -1
- data/lib/mongo/error/socket_timeout_error.rb +4 -1
- data/lib/mongo/error/unchangeable_collection_option.rb +4 -1
- data/lib/mongo/error/unexpected_chunk_length.rb +4 -1
- data/lib/mongo/error/unexpected_response.rb +4 -1
- data/lib/mongo/error/unknown_payload_type.rb +4 -1
- data/lib/mongo/error/unmet_dependency.rb +24 -0
- data/lib/mongo/error/unsupported_array_filters.rb +10 -2
- data/lib/mongo/error/unsupported_collation.rb +10 -2
- data/lib/mongo/error/unsupported_features.rb +4 -1
- data/lib/mongo/error/unsupported_message_type.rb +4 -1
- data/lib/mongo/error/unsupported_option.rb +104 -0
- data/lib/mongo/error/write_retryable.rb +4 -1
- data/lib/mongo/error.rb +48 -4
- data/lib/mongo/event/base.rb +10 -1
- data/lib/mongo/event/listeners.rb +4 -1
- data/lib/mongo/event/publisher.rb +4 -1
- data/lib/mongo/event/subscriber.rb +4 -1
- data/lib/mongo/event.rb +5 -2
- data/lib/mongo/grid/file/chunk.rb +5 -2
- data/lib/mongo/grid/file/info.rb +7 -3
- data/lib/mongo/grid/file.rb +4 -1
- data/lib/mongo/grid/fs_bucket.rb +74 -48
- data/lib/mongo/grid/stream/read.rb +23 -8
- data/lib/mongo/grid/stream/write.rb +4 -1
- data/lib/mongo/grid/stream.rb +4 -1
- data/lib/mongo/grid.rb +4 -1
- data/lib/mongo/id.rb +4 -1
- data/lib/mongo/index/view.rb +78 -15
- data/lib/mongo/index.rb +5 -1
- data/lib/mongo/lint.rb +14 -0
- data/lib/mongo/loggable.rb +9 -2
- data/lib/mongo/logger.rb +7 -4
- data/lib/mongo/monitoring/cmap_log_subscriber.rb +4 -1
- data/lib/mongo/monitoring/command_log_subscriber.rb +24 -4
- data/lib/mongo/monitoring/event/cmap/base.rb +4 -1
- data/lib/mongo/monitoring/event/cmap/connection_check_out_failed.rb +12 -2
- data/lib/mongo/monitoring/event/cmap/connection_check_out_started.rb +4 -1
- data/lib/mongo/monitoring/event/cmap/connection_checked_in.rb +15 -4
- data/lib/mongo/monitoring/event/cmap/connection_checked_out.rb +15 -4
- data/lib/mongo/monitoring/event/cmap/connection_closed.rb +4 -1
- data/lib/mongo/monitoring/event/cmap/connection_created.rb +4 -1
- data/lib/mongo/monitoring/event/cmap/connection_ready.rb +4 -1
- data/lib/mongo/monitoring/event/cmap/pool_cleared.rb +4 -1
- data/lib/mongo/monitoring/event/cmap/pool_closed.rb +15 -4
- data/lib/mongo/monitoring/event/cmap/pool_created.rb +16 -4
- data/lib/mongo/monitoring/event/cmap.rb +4 -1
- data/lib/mongo/monitoring/event/command_failed.rb +44 -6
- data/lib/mongo/monitoring/event/command_started.rb +79 -5
- data/lib/mongo/monitoring/event/command_succeeded.rb +41 -4
- data/lib/mongo/monitoring/event/secure.rb +44 -4
- data/lib/mongo/monitoring/event/server_closed.rb +5 -2
- data/lib/mongo/monitoring/event/server_description_changed.rb +31 -5
- data/lib/mongo/monitoring/event/server_heartbeat_failed.rb +39 -18
- data/lib/mongo/monitoring/event/server_heartbeat_started.rb +13 -3
- data/lib/mongo/monitoring/event/server_heartbeat_succeeded.rb +34 -13
- data/lib/mongo/monitoring/event/server_opening.rb +5 -2
- data/lib/mongo/monitoring/event/topology_changed.rb +5 -2
- data/lib/mongo/monitoring/event/topology_closed.rb +5 -2
- data/lib/mongo/monitoring/event/topology_opening.rb +5 -2
- data/lib/mongo/monitoring/event.rb +4 -1
- data/lib/mongo/monitoring/publishable.rb +41 -17
- data/lib/mongo/monitoring/sdam_log_subscriber.rb +4 -1
- data/lib/mongo/monitoring/server_closed_log_subscriber.rb +4 -1
- data/lib/mongo/monitoring/server_description_changed_log_subscriber.rb +13 -2
- data/lib/mongo/monitoring/server_opening_log_subscriber.rb +4 -1
- data/lib/mongo/monitoring/topology_changed_log_subscriber.rb +5 -2
- data/lib/mongo/monitoring/topology_closed_log_subscriber.rb +4 -1
- data/lib/mongo/monitoring/topology_opening_log_subscriber.rb +4 -1
- data/lib/mongo/monitoring/unified_sdam_log_subscriber.rb +65 -0
- data/lib/mongo/monitoring.rb +52 -1
- data/lib/mongo/operation/aggregate/command.rb +8 -5
- data/lib/mongo/operation/aggregate/op_msg.rb +4 -1
- data/lib/mongo/operation/aggregate/result.rb +13 -9
- data/lib/mongo/operation/aggregate.rb +4 -1
- data/lib/mongo/operation/collections_info/command.rb +48 -0
- data/lib/mongo/operation/collections_info/result.rb +22 -2
- data/lib/mongo/operation/collections_info.rb +18 -28
- data/lib/mongo/operation/command/command.rb +6 -3
- data/lib/mongo/operation/command/op_msg.rb +4 -1
- data/lib/mongo/operation/command.rb +4 -1
- data/lib/mongo/operation/context.rb +102 -0
- data/lib/mongo/operation/count/command.rb +6 -3
- data/lib/mongo/operation/count/op_msg.rb +4 -1
- data/lib/mongo/operation/count.rb +4 -1
- data/lib/mongo/operation/create/command.rb +6 -3
- data/lib/mongo/operation/create/op_msg.rb +4 -1
- data/lib/mongo/operation/create.rb +4 -1
- data/lib/mongo/operation/create_index/command.rb +7 -4
- data/lib/mongo/operation/create_index/op_msg.rb +9 -3
- data/lib/mongo/operation/create_index.rb +4 -1
- data/lib/mongo/operation/create_user/command.rb +8 -4
- data/lib/mongo/operation/create_user/op_msg.rb +5 -2
- data/lib/mongo/operation/create_user.rb +4 -1
- data/lib/mongo/operation/delete/bulk_result.rb +6 -1
- data/lib/mongo/operation/delete/command.rb +7 -4
- data/lib/mongo/operation/delete/legacy.rb +5 -2
- data/lib/mongo/operation/delete/op_msg.rb +8 -5
- data/lib/mongo/operation/delete/result.rb +8 -2
- data/lib/mongo/operation/delete.rb +4 -1
- data/lib/mongo/operation/distinct/command.rb +6 -3
- data/lib/mongo/operation/distinct/op_msg.rb +4 -1
- data/lib/mongo/operation/distinct.rb +4 -1
- data/lib/mongo/operation/drop/command.rb +6 -3
- data/lib/mongo/operation/drop/op_msg.rb +4 -1
- data/lib/mongo/operation/drop.rb +4 -1
- data/lib/mongo/operation/drop_database/command.rb +6 -3
- data/lib/mongo/operation/drop_database/op_msg.rb +4 -1
- data/lib/mongo/operation/drop_database.rb +4 -1
- data/lib/mongo/operation/drop_index/command.rb +7 -4
- data/lib/mongo/operation/drop_index/op_msg.rb +5 -2
- data/lib/mongo/operation/drop_index.rb +4 -1
- data/lib/mongo/operation/explain/command.rb +10 -3
- data/lib/mongo/operation/explain/legacy.rb +10 -3
- data/lib/mongo/operation/explain/op_msg.rb +10 -1
- data/lib/mongo/operation/explain/result.rb +7 -1
- data/lib/mongo/operation/explain.rb +4 -1
- data/lib/mongo/operation/find/command.rb +6 -3
- data/lib/mongo/operation/find/legacy/result.rb +6 -1
- data/lib/mongo/operation/find/legacy.rb +6 -3
- data/lib/mongo/operation/find/op_msg.rb +5 -9
- data/lib/mongo/operation/find/result.rb +17 -1
- data/lib/mongo/operation/find.rb +4 -1
- data/lib/mongo/operation/get_more/command.rb +6 -3
- data/lib/mongo/operation/get_more/legacy.rb +5 -2
- data/lib/mongo/operation/get_more/op_msg.rb +5 -9
- data/lib/mongo/operation/get_more/result.rb +7 -1
- data/lib/mongo/operation/get_more.rb +4 -1
- data/lib/mongo/operation/indexes/command.rb +6 -3
- data/lib/mongo/operation/indexes/legacy.rb +7 -4
- data/lib/mongo/operation/indexes/op_msg.rb +4 -1
- data/lib/mongo/operation/indexes/result.rb +9 -1
- data/lib/mongo/operation/indexes.rb +19 -2
- data/lib/mongo/operation/insert/bulk_result.rb +14 -2
- data/lib/mongo/operation/insert/command.rb +11 -7
- data/lib/mongo/operation/insert/legacy.rb +13 -5
- data/lib/mongo/operation/insert/op_msg.rb +10 -7
- data/lib/mongo/operation/insert/result.rb +15 -4
- data/lib/mongo/operation/insert.rb +6 -2
- data/lib/mongo/operation/kill_cursors/command.rb +6 -3
- data/lib/mongo/operation/kill_cursors/legacy.rb +5 -2
- data/lib/mongo/operation/kill_cursors/op_msg.rb +4 -1
- data/lib/mongo/operation/kill_cursors.rb +4 -1
- data/lib/mongo/operation/list_collections/command.rb +7 -4
- data/lib/mongo/operation/list_collections/op_msg.rb +5 -2
- data/lib/mongo/operation/list_collections/result.rb +13 -2
- data/lib/mongo/operation/list_collections.rb +4 -1
- data/lib/mongo/operation/map_reduce/command.rb +6 -3
- data/lib/mongo/operation/map_reduce/op_msg.rb +4 -1
- data/lib/mongo/operation/map_reduce/result.rb +14 -1
- data/lib/mongo/operation/map_reduce.rb +4 -1
- data/lib/mongo/operation/op_msg_base.rb +6 -3
- data/lib/mongo/operation/parallel_scan/command.rb +8 -6
- data/lib/mongo/operation/parallel_scan/op_msg.rb +5 -2
- data/lib/mongo/operation/parallel_scan/result.rb +8 -1
- data/lib/mongo/operation/parallel_scan.rb +4 -1
- data/lib/mongo/operation/remove_user/command.rb +8 -4
- data/lib/mongo/operation/remove_user/op_msg.rb +5 -2
- data/lib/mongo/operation/remove_user.rb +4 -1
- data/lib/mongo/operation/result.rb +104 -37
- data/lib/mongo/operation/shared/bypass_document_validation.rb +14 -4
- data/lib/mongo/operation/shared/causal_consistency_supported.rb +7 -3
- data/lib/mongo/operation/shared/executable.rb +60 -34
- data/lib/mongo/operation/shared/executable_no_validate.rb +6 -3
- data/lib/mongo/operation/shared/executable_transaction_label.rb +4 -1
- data/lib/mongo/operation/shared/idable.rb +6 -2
- data/lib/mongo/operation/shared/limited.rb +14 -2
- data/lib/mongo/operation/shared/object_id_generator.rb +5 -1
- data/lib/mongo/operation/shared/op_msg_or_command.rb +7 -8
- data/lib/mongo/operation/shared/op_msg_or_find_command.rb +8 -9
- data/lib/mongo/operation/shared/polymorphic_lookup.rb +4 -1
- data/lib/mongo/operation/shared/polymorphic_operation.rb +42 -0
- data/lib/mongo/operation/shared/polymorphic_result.rb +4 -1
- data/lib/mongo/operation/shared/read_preference_supported.rb +80 -23
- data/lib/mongo/operation/shared/response_handling.rb +91 -13
- data/lib/mongo/operation/shared/result/aggregatable.rb +5 -1
- data/lib/mongo/operation/shared/result/use_legacy_error_parser.rb +4 -1
- data/lib/mongo/operation/shared/sessions_supported.rb +104 -28
- data/lib/mongo/operation/shared/specifiable.rb +36 -20
- data/lib/mongo/operation/shared/write.rb +31 -24
- data/lib/mongo/operation/shared/write_concern_supported.rb +10 -6
- data/lib/mongo/operation/update/bulk_result.rb +4 -1
- data/lib/mongo/operation/update/command.rb +7 -4
- data/lib/mongo/operation/update/legacy/result.rb +11 -1
- data/lib/mongo/operation/update/legacy.rb +5 -2
- data/lib/mongo/operation/update/op_msg.rb +8 -5
- data/lib/mongo/operation/update/result.rb +13 -2
- data/lib/mongo/operation/update.rb +4 -1
- data/lib/mongo/operation/update_user/command.rb +8 -4
- data/lib/mongo/operation/update_user/op_msg.rb +5 -2
- data/lib/mongo/operation/update_user.rb +4 -1
- data/lib/mongo/operation/users_info/command.rb +7 -4
- data/lib/mongo/operation/users_info/op_msg.rb +5 -2
- data/lib/mongo/operation/users_info/result.rb +7 -1
- data/lib/mongo/operation/users_info.rb +4 -1
- data/lib/mongo/operation.rb +7 -1
- data/lib/mongo/options/mapper.rb +4 -1
- data/lib/mongo/options/redacted.rb +4 -1
- data/lib/mongo/options.rb +4 -1
- data/lib/mongo/protocol/bit_vector.rb +6 -2
- data/lib/mongo/protocol/compressed.rb +61 -11
- data/lib/mongo/protocol/delete.rb +4 -1
- data/lib/mongo/protocol/get_more.rb +4 -1
- data/lib/mongo/protocol/insert.rb +7 -2
- data/lib/mongo/protocol/kill_cursors.rb +4 -1
- data/lib/mongo/protocol/message.rb +158 -21
- data/lib/mongo/protocol/msg.rb +248 -41
- data/lib/mongo/protocol/query.rb +62 -24
- data/lib/mongo/protocol/registry.rb +4 -1
- data/lib/mongo/protocol/reply.rb +4 -1
- data/lib/mongo/protocol/serializers.rb +47 -16
- data/lib/mongo/protocol/update.rb +4 -1
- data/lib/mongo/protocol.rb +3 -0
- data/lib/mongo/query_cache.rb +275 -0
- data/lib/mongo/retryable.rb +36 -13
- data/lib/mongo/semaphore.rb +5 -2
- data/lib/mongo/server/app_metadata.rb +128 -35
- data/lib/mongo/server/connection.rb +52 -111
- data/lib/mongo/server/connection_base.rb +167 -35
- data/lib/mongo/server/connection_common.rb +168 -0
- data/lib/mongo/server/connection_pool/populator.rb +61 -0
- data/lib/mongo/server/connection_pool.rb +315 -42
- data/lib/mongo/server/context.rb +4 -1
- data/lib/mongo/server/description/features.rb +23 -10
- data/lib/mongo/server/description.rb +135 -46
- data/lib/mongo/server/monitor/app_metadata.rb +5 -2
- data/lib/mongo/server/monitor/connection.rb +142 -116
- data/lib/mongo/server/monitor.rb +197 -131
- data/lib/mongo/server/pending_connection.rb +237 -1
- data/lib/mongo/server/push_monitor/connection.rb +31 -0
- data/lib/mongo/server/push_monitor.rb +194 -0
- data/lib/mongo/server/round_trip_time_averager.rb +18 -6
- data/lib/mongo/server.rb +197 -68
- data/lib/mongo/server_selector/{selectable.rb → base.rb} +183 -95
- data/lib/mongo/server_selector/nearest.rb +32 -25
- data/lib/mongo/server_selector/primary.rb +30 -32
- data/lib/mongo/server_selector/primary_preferred.rb +38 -29
- data/lib/mongo/server_selector/secondary.rb +32 -25
- data/lib/mongo/server_selector/secondary_preferred.rb +30 -38
- data/lib/mongo/server_selector.rb +5 -2
- data/lib/mongo/session/server_session.rb +4 -1
- data/lib/mongo/session/session_pool.rb +14 -4
- data/lib/mongo/session.rb +48 -37
- data/lib/mongo/socket/ocsp_cache.rb +100 -0
- data/lib/mongo/socket/ocsp_verifier.rb +376 -0
- data/lib/mongo/socket/ssl.rb +165 -55
- data/lib/mongo/socket/tcp.rb +45 -25
- data/lib/mongo/socket/unix.rb +17 -6
- data/lib/mongo/socket.rb +176 -42
- data/lib/mongo/srv/monitor.rb +113 -0
- data/lib/mongo/srv/resolver.rb +137 -0
- data/lib/mongo/srv/result.rb +128 -0
- data/lib/mongo/srv.rb +20 -0
- data/lib/mongo/timeout.rb +54 -0
- data/lib/mongo/topology_version.rb +92 -0
- data/lib/mongo/uri/options_mapper.rb +623 -0
- data/lib/mongo/uri/srv_protocol.rb +105 -46
- data/lib/mongo/uri.rb +102 -471
- data/lib/mongo/utils.rb +118 -0
- data/lib/mongo/version.rb +5 -2
- data/lib/mongo/write_concern/acknowledged.rb +4 -1
- data/lib/mongo/write_concern/base.rb +4 -1
- data/lib/mongo/write_concern/unacknowledged.rb +4 -1
- data/lib/mongo/write_concern.rb +4 -1
- data/lib/mongo.rb +47 -2
- data/mongo.gemspec +14 -8
- data/spec/NOTES.aws-auth.md +296 -0
- data/spec/README.aws-auth.md +318 -0
- data/spec/README.md +491 -24
- data/spec/USERS.md +72 -0
- data/spec/atlas/atlas_connectivity_spec.rb +3 -0
- data/spec/atlas/operations_spec.rb +3 -0
- data/spec/integration/auth_spec.rb +135 -16
- data/spec/integration/awaited_ismaster_spec.rb +31 -0
- data/spec/integration/aws_auth_request_spec.rb +77 -0
- data/spec/integration/aws_credentials_retriever_spec.rb +106 -0
- data/spec/integration/bson_symbol_spec.rb +8 -3
- data/spec/integration/bulk_insert_spec.rb +3 -0
- data/spec/integration/bulk_write_error_message_spec.rb +41 -0
- data/spec/integration/bulk_write_spec.rb +70 -0
- data/spec/integration/change_stream_examples_spec.rb +9 -6
- data/spec/integration/change_stream_spec.rb +128 -53
- data/spec/integration/check_clean_slate_spec.rb +19 -0
- data/spec/integration/client_authentication_options_spec.rb +514 -0
- data/spec/integration/client_connectivity_spec.rb +4 -1
- data/spec/integration/client_construction_aws_auth_spec.rb +194 -0
- data/spec/integration/client_construction_spec.rb +134 -3
- data/spec/integration/client_side_encryption/auto_encryption_bulk_writes_spec.rb +360 -0
- data/spec/integration/client_side_encryption/auto_encryption_command_monitoring_spec.rb +306 -0
- data/spec/integration/client_side_encryption/auto_encryption_mongocryptd_spawn_spec.rb +75 -0
- data/spec/integration/client_side_encryption/auto_encryption_old_wire_version_spec.rb +82 -0
- data/spec/integration/client_side_encryption/auto_encryption_reconnect_spec.rb +224 -0
- data/spec/integration/client_side_encryption/auto_encryption_spec.rb +604 -0
- data/spec/integration/client_side_encryption/bson_size_limit_spec.rb +190 -0
- data/spec/integration/client_side_encryption/bypass_mongocryptd_spawn_spec.rb +81 -0
- data/spec/integration/client_side_encryption/client_close_spec.rb +66 -0
- data/spec/integration/client_side_encryption/corpus_spec.rb +236 -0
- data/spec/integration/client_side_encryption/custom_endpoint_spec.rb +135 -0
- data/spec/integration/client_side_encryption/data_key_spec.rb +168 -0
- data/spec/integration/client_side_encryption/explicit_encryption_spec.rb +117 -0
- data/spec/integration/client_side_encryption/external_key_vault_spec.rb +144 -0
- data/spec/integration/client_side_encryption/views_spec.rb +47 -0
- data/spec/integration/client_spec.rb +5 -2
- data/spec/integration/client_update_spec.rb +157 -0
- data/spec/integration/collection_indexes_prose_spec.rb +58 -0
- data/spec/integration/command_monitoring_spec.rb +97 -30
- data/spec/integration/command_spec.rb +58 -19
- data/spec/integration/connect_single_rs_name_spec.rb +17 -9
- data/spec/integration/connection_pool_populator_spec.rb +305 -0
- data/spec/integration/connection_spec.rb +159 -34
- data/spec/integration/crud_spec.rb +152 -4
- data/spec/integration/cursor_reaping_spec.rb +71 -28
- data/spec/integration/docs_examples_spec.rb +13 -1
- data/spec/integration/error_detection_spec.rb +3 -0
- data/spec/integration/fork_reconnect_spec.rb +204 -0
- data/spec/integration/get_more_spec.rb +13 -3
- data/spec/integration/grid_fs_bucket_spec.rb +4 -1
- data/spec/integration/heartbeat_events_spec.rb +27 -41
- data/spec/integration/mmapv1_spec.rb +3 -0
- data/spec/integration/mongos_pinning_spec.rb +3 -0
- data/spec/integration/ocsp_connectivity_spec.rb +29 -0
- data/spec/integration/ocsp_verifier_cache_spec.rb +191 -0
- data/spec/integration/ocsp_verifier_spec.rb +355 -0
- data/spec/integration/operation_failure_code_spec.rb +4 -1
- data/spec/integration/operation_failure_message_spec.rb +90 -0
- data/spec/integration/query_cache_spec.rb +1093 -0
- data/spec/integration/query_cache_transactions_spec.rb +193 -0
- data/spec/integration/read_concern_spec.rb +4 -1
- data/spec/integration/read_preference_spec.rb +70 -11
- data/spec/integration/reconnect_spec.rb +147 -1
- data/spec/integration/retryable_errors_spec.rb +38 -17
- data/spec/integration/{retryable_writes_spec.rb → retryable_writes/retryable_writes_36_and_older_spec.rb} +58 -51
- data/spec/integration/retryable_writes/retryable_writes_40_and_newer_spec.rb +405 -0
- data/spec/integration/retryable_writes/shared/adds_diagnostics.rb +18 -0
- data/spec/integration/retryable_writes/shared/does_not_support_retries.rb +27 -0
- data/spec/integration/retryable_writes/shared/only_supports_legacy_retries.rb +28 -0
- data/spec/integration/retryable_writes/shared/performs_legacy_retries.rb +220 -0
- data/spec/integration/retryable_writes/shared/performs_modern_retries.rb +235 -0
- data/spec/integration/retryable_writes/shared/performs_no_retries.rb +113 -0
- data/spec/integration/retryable_writes/shared/supports_legacy_retries.rb +22 -0
- data/spec/integration/retryable_writes/shared/supports_modern_retries.rb +28 -0
- data/spec/integration/retryable_writes/shared/supports_retries.rb +19 -0
- data/spec/integration/retryable_writes_errors_spec.rb +14 -14
- data/spec/integration/sdam_error_handling_spec.rb +257 -43
- data/spec/integration/sdam_events_spec.rb +88 -13
- data/spec/integration/sdam_prose_spec.rb +67 -0
- data/spec/integration/secondary_reads_spec.rb +102 -0
- data/spec/integration/server_description_spec.rb +3 -0
- data/spec/integration/server_monitor_spec.rb +55 -0
- data/spec/integration/server_selection_spec.rb +39 -0
- data/spec/integration/server_selector_spec.rb +10 -5
- data/spec/integration/server_spec.rb +45 -26
- data/spec/integration/shell_examples_spec.rb +3 -0
- data/spec/integration/{size_limit_spec.rb~12e1e9c4f... RUBY-2242 Fix zlib compression (#2021) → size_limit_spec.rb} +26 -9
- data/spec/integration/snappy_compression_spec.rb +28 -0
- data/spec/integration/srv_monitoring_spec.rb +406 -0
- data/spec/integration/srv_spec.rb +59 -0
- data/spec/integration/ssl_uri_options_spec.rb +5 -2
- data/spec/integration/step_down_spec.rb +19 -18
- data/spec/integration/time_zone_querying_spec.rb +3 -0
- data/spec/integration/transactions_api_examples_spec.rb +62 -0
- data/spec/integration/transactions_examples_spec.rb +31 -9
- data/spec/integration/truncated_utf8_spec.rb +26 -0
- data/spec/integration/versioned_api_examples_spec.rb +69 -0
- data/spec/integration/x509_auth_spec.rb +112 -0
- data/spec/integration/zlib_compression_spec.rb +28 -0
- data/spec/integration/zstd_compression_spec.rb +29 -0
- data/spec/kerberos/kerberos_spec.rb +94 -0
- data/spec/lite_spec_helper.rb +85 -33
- data/spec/mongo/address/ipv4_spec.rb +4 -1
- data/spec/mongo/address/ipv6_spec.rb +3 -0
- data/spec/mongo/address/unix_spec.rb +3 -0
- data/spec/mongo/address/validator_spec.rb +54 -0
- data/spec/mongo/address_spec.rb +37 -24
- data/spec/mongo/auth/aws/request_region_spec.rb +45 -0
- data/spec/mongo/auth/aws/request_spec.rb +79 -0
- data/spec/mongo/auth/cr_spec.rb +19 -36
- data/spec/mongo/auth/gssapi/conversation_spec.rb +124 -0
- data/spec/mongo/auth/invalid_mechanism_spec.rb +4 -1
- data/spec/mongo/auth/ldap/conversation_spec.rb +6 -3
- data/spec/mongo/auth/ldap_spec.rb +17 -34
- data/spec/mongo/auth/scram/conversation_spec.rb +124 -328
- data/spec/mongo/auth/scram256/conversation_spec.rb +174 -0
- data/spec/mongo/auth/{scram/negotiation_spec.rb → scram_negotiation_spec.rb} +83 -76
- data/spec/mongo/auth/scram_spec.rb +56 -110
- data/spec/mongo/auth/stringprep/profiles/sasl_spec.rb +3 -0
- data/spec/mongo/auth/stringprep_spec.rb +3 -0
- data/spec/mongo/auth/user/view_spec.rb +108 -7
- data/spec/mongo/auth/user_spec.rb +61 -17
- data/spec/mongo/auth/x509/conversation_spec.rb +8 -5
- data/spec/mongo/auth/x509_spec.rb +42 -33
- data/spec/mongo/auth_spec.rb +7 -4
- data/spec/mongo/bson_spec.rb +3 -0
- data/spec/mongo/bulk_write/ordered_combiner_spec.rb +3 -0
- data/spec/mongo/bulk_write/result_spec.rb +14 -7
- data/spec/mongo/bulk_write/unordered_combiner_spec.rb +3 -0
- data/spec/mongo/bulk_write_spec.rb +209 -2
- data/spec/mongo/caching_cursor_spec.rb +73 -0
- data/spec/mongo/client_construction_spec.rb +1296 -305
- data/spec/mongo/client_encryption_spec.rb +414 -0
- data/spec/mongo/client_spec.rb +157 -32
- data/spec/mongo/cluster/cursor_reaper_spec.rb +15 -8
- data/spec/mongo/cluster/periodic_executor_spec.rb +19 -0
- data/spec/mongo/cluster/socket_reaper_spec.rb +17 -3
- data/spec/mongo/cluster/topology/replica_set_spec.rb +81 -30
- data/spec/mongo/cluster/topology/sharded_spec.rb +18 -12
- data/spec/mongo/cluster/topology/single_spec.rb +44 -21
- data/spec/mongo/cluster/topology/unknown_spec.rb +4 -1
- data/spec/mongo/cluster/topology_spec.rb +4 -1
- data/spec/mongo/cluster_spec.rb +114 -48
- data/spec/mongo/cluster_time_spec.rb +3 -0
- data/spec/mongo/collection/view/aggregation_spec.rb +9 -4
- data/spec/mongo/collection/view/builder/find_command_spec.rb +20 -6
- data/spec/mongo/collection/view/builder/flags_spec.rb +3 -0
- data/spec/mongo/collection/view/builder/modifiers_spec.rb +3 -0
- data/spec/mongo/collection/view/builder/op_query_spec.rb +3 -0
- data/spec/mongo/collection/view/change_stream_resume_spec.rb +397 -0
- data/spec/mongo/collection/view/change_stream_spec.rb +21 -323
- data/spec/mongo/collection/view/explainable_spec.rb +90 -4
- data/spec/mongo/collection/view/immutable_spec.rb +3 -0
- data/spec/mongo/collection/view/iterable_spec.rb +41 -0
- data/spec/mongo/collection/view/map_reduce_spec.rb +29 -15
- data/spec/mongo/collection/view/readable_spec.rb +92 -21
- data/spec/mongo/collection/view/writable_spec.rb +211 -1
- data/spec/mongo/collection/view_spec.rb +4 -1
- data/spec/mongo/collection_crud_spec.rb +4360 -0
- data/spec/mongo/collection_ddl_spec.rb +537 -0
- data/spec/mongo/collection_spec.rb +21 -4361
- data/spec/mongo/crypt/auto_decryption_context_spec.rb +93 -0
- data/spec/mongo/crypt/auto_encrypter_spec.rb +190 -0
- data/spec/mongo/crypt/auto_encryption_context_spec.rb +110 -0
- data/spec/mongo/crypt/binary_spec.rb +113 -0
- data/spec/mongo/crypt/binding/binary_spec.rb +54 -0
- data/spec/mongo/crypt/binding/context_spec.rb +255 -0
- data/spec/mongo/crypt/binding/helpers_spec.rb +44 -0
- data/spec/mongo/crypt/binding/mongocrypt_spec.rb +142 -0
- data/spec/mongo/crypt/binding/status_spec.rb +97 -0
- data/spec/mongo/crypt/binding/version_spec.rb +20 -0
- data/spec/mongo/crypt/binding_unloaded_spec.rb +23 -0
- data/spec/mongo/crypt/data_key_context_spec.rb +216 -0
- data/spec/mongo/crypt/encryption_io_spec.rb +139 -0
- data/spec/mongo/crypt/explicit_decryption_context_spec.rb +75 -0
- data/spec/mongo/crypt/explicit_encryption_context_spec.rb +173 -0
- data/spec/mongo/crypt/handle_spec.rb +235 -0
- data/spec/mongo/crypt/helpers/mongo_crypt_spec_helper.rb +111 -0
- data/spec/mongo/crypt/status_spec.rb +150 -0
- data/spec/mongo/cursor/builder/get_more_command_spec.rb +11 -1
- data/spec/mongo/cursor/builder/op_get_more_spec.rb +11 -1
- data/spec/mongo/cursor/builder/op_kill_cursors_spec.rb +11 -1
- data/spec/mongo/cursor_spec.rb +130 -15
- data/spec/mongo/database_spec.rb +451 -17
- data/spec/mongo/dbref_spec.rb +3 -0
- data/spec/mongo/distinguishing_semaphore_spec.rb +66 -0
- data/spec/mongo/error/bulk_write_error_spec.rb +52 -0
- data/spec/mongo/error/crypt_error_spec.rb +29 -0
- data/spec/mongo/error/max_bson_size_spec.rb +38 -0
- data/spec/mongo/error/no_server_available_spec.rb +15 -2
- data/spec/mongo/error/notable_spec.rb +62 -0
- data/spec/mongo/error/operation_failure_heavy_spec.rb +61 -0
- data/spec/mongo/error/operation_failure_spec.rb +231 -70
- data/spec/mongo/error/parser_spec.rb +40 -6
- data/spec/mongo/error/unsupported_option_spec.rb +57 -0
- data/spec/mongo/event/publisher_spec.rb +3 -0
- data/spec/mongo/event/subscriber_spec.rb +3 -0
- data/spec/mongo/grid/file/chunk_spec.rb +7 -4
- data/spec/mongo/grid/file/info_spec.rb +3 -0
- data/spec/mongo/grid/file_spec.rb +4 -1
- data/spec/mongo/grid/fs_bucket_spec.rb +40 -5
- data/spec/mongo/grid/stream/read_spec.rb +33 -10
- data/spec/mongo/grid/stream/write_spec.rb +35 -0
- data/spec/mongo/grid/stream_spec.rb +3 -0
- data/spec/mongo/id_spec.rb +3 -0
- data/spec/mongo/index/view_spec.rb +321 -0
- data/spec/mongo/lint_spec.rb +3 -0
- data/spec/mongo/logger_spec.rb +16 -11
- data/spec/mongo/monitoring/command_log_subscriber_spec.rb +3 -0
- data/spec/mongo/monitoring/event/cmap/connection_check_out_failed_spec.rb +3 -0
- data/spec/mongo/monitoring/event/cmap/connection_check_out_started_spec.rb +3 -0
- data/spec/mongo/monitoring/event/cmap/connection_checked_in_spec.rb +13 -3
- data/spec/mongo/monitoring/event/cmap/connection_checked_out_spec.rb +13 -3
- data/spec/mongo/monitoring/event/cmap/connection_closed_spec.rb +3 -0
- data/spec/mongo/monitoring/event/cmap/connection_created_spec.rb +3 -0
- data/spec/mongo/monitoring/event/cmap/connection_ready_spec.rb +3 -0
- data/spec/mongo/monitoring/event/cmap/pool_cleared_spec.rb +3 -0
- data/spec/mongo/monitoring/event/cmap/pool_closed_spec.rb +13 -3
- data/spec/mongo/monitoring/event/cmap/pool_created_spec.rb +13 -3
- data/spec/mongo/monitoring/event/command_failed_spec.rb +59 -2
- data/spec/mongo/monitoring/event/command_started_spec.rb +3 -0
- data/spec/mongo/monitoring/event/command_succeeded_spec.rb +46 -6
- data/spec/mongo/monitoring/event/secure_spec.rb +28 -4
- data/spec/mongo/monitoring/event/server_closed_spec.rb +4 -1
- data/spec/mongo/monitoring/event/server_description_changed_spec.rb +4 -4
- data/spec/mongo/monitoring/event/server_heartbeat_failed_spec.rb +4 -1
- data/spec/mongo/monitoring/event/server_heartbeat_started_spec.rb +3 -0
- data/spec/mongo/monitoring/event/server_heartbeat_succeeded_spec.rb +4 -1
- data/spec/mongo/monitoring/event/server_opening_spec.rb +4 -1
- data/spec/mongo/monitoring/event/topology_changed_spec.rb +4 -1
- data/spec/mongo/monitoring/event/topology_closed_spec.rb +4 -1
- data/spec/mongo/monitoring/event/topology_opening_spec.rb +4 -1
- data/spec/mongo/monitoring_spec.rb +3 -0
- data/spec/mongo/operation/aggregate/result_spec.rb +11 -1
- data/spec/mongo/operation/aggregate_spec.rb +5 -1
- data/spec/mongo/operation/collections_info_spec.rb +7 -1
- data/spec/mongo/operation/command_spec.rb +11 -5
- data/spec/mongo/operation/create_index_spec.rb +9 -3
- data/spec/mongo/operation/create_user_spec.rb +9 -3
- data/spec/mongo/operation/delete/bulk_spec.rb +24 -6
- data/spec/mongo/operation/delete/command_spec.rb +3 -0
- data/spec/mongo/operation/delete/op_msg_spec.rb +36 -21
- data/spec/mongo/operation/delete_spec.rb +14 -7
- data/spec/mongo/operation/drop_index_spec.rb +9 -2
- data/spec/mongo/operation/find/legacy_spec.rb +33 -7
- data/spec/mongo/operation/get_more_spec.rb +11 -1
- data/spec/mongo/operation/indexes_spec.rb +8 -1
- data/spec/mongo/operation/insert/bulk_spec.rb +27 -7
- data/spec/mongo/operation/insert/command_spec.rb +7 -0
- data/spec/mongo/operation/insert/op_msg_spec.rb +67 -44
- data/spec/mongo/operation/insert_spec.rb +18 -12
- data/spec/mongo/operation/kill_cursors_spec.rb +3 -0
- data/spec/mongo/operation/limited_spec.rb +8 -3
- data/spec/mongo/operation/map_reduce_spec.rb +8 -2
- data/spec/mongo/operation/read_preference_legacy_spec.rb +356 -0
- data/spec/mongo/operation/read_preference_op_msg_spec.rb +307 -0
- data/spec/mongo/operation/remove_user_spec.rb +9 -3
- data/spec/mongo/operation/result_spec.rb +14 -4
- data/spec/mongo/operation/specifiable_spec.rb +3 -0
- data/spec/mongo/operation/update/bulk_spec.rb +24 -6
- data/spec/mongo/operation/update/command_spec.rb +7 -0
- data/spec/mongo/operation/update/op_msg_spec.rb +35 -20
- data/spec/mongo/operation/update_spec.rb +13 -7
- data/spec/mongo/operation/update_user_spec.rb +7 -1
- data/spec/mongo/options/redacted_spec.rb +3 -0
- data/spec/mongo/protocol/compressed_spec.rb +29 -13
- data/spec/mongo/protocol/delete_spec.rb +12 -8
- data/spec/mongo/protocol/get_more_spec.rb +12 -8
- data/spec/mongo/protocol/insert_spec.rb +12 -8
- data/spec/mongo/protocol/kill_cursors_spec.rb +9 -5
- data/spec/mongo/protocol/msg_spec.rb +70 -53
- data/spec/mongo/protocol/query_spec.rb +18 -15
- data/spec/mongo/protocol/registry_spec.rb +4 -1
- data/spec/mongo/protocol/reply_spec.rb +4 -1
- data/spec/mongo/protocol/update_spec.rb +13 -9
- data/spec/mongo/query_cache_middleware_spec.rb +55 -0
- data/spec/mongo/query_cache_spec.rb +283 -0
- data/spec/mongo/retryable_spec.rb +77 -72
- data/spec/mongo/semaphore_spec.rb +54 -0
- data/spec/mongo/server/app_metadata_spec.rb +53 -29
- data/spec/mongo/server/connection_auth_spec.rb +45 -23
- data/spec/mongo/server/connection_common_spec.rb +24 -0
- data/spec/mongo/server/connection_pool/populator_spec.rb +106 -0
- data/spec/mongo/server/connection_pool_spec.rb +259 -130
- data/spec/mongo/server/connection_spec.rb +277 -121
- data/spec/mongo/server/description/features_spec.rb +3 -0
- data/spec/mongo/server/description_query_methods_spec.rb +4 -1
- data/spec/mongo/server/description_spec.rb +630 -561
- data/spec/mongo/server/monitor/app_metadata_spec.rb +10 -1
- data/spec/mongo/server/monitor/connection_spec.rb +66 -79
- data/spec/mongo/server/monitor_spec.rb +173 -126
- data/spec/mongo/server/round_trip_time_averager_spec.rb +8 -3
- data/spec/mongo/server_selector/nearest_spec.rb +32 -25
- data/spec/mongo/server_selector/primary_preferred_spec.rb +35 -28
- data/spec/mongo/server_selector/primary_spec.rb +35 -11
- data/spec/mongo/server_selector/secondary_preferred_spec.rb +52 -29
- data/spec/mongo/server_selector/secondary_spec.rb +27 -20
- data/spec/mongo/server_selector_spec.rb +11 -8
- data/spec/mongo/server_spec.rb +100 -62
- data/spec/mongo/session/server_session_spec.rb +3 -0
- data/spec/mongo/session/session_pool_spec.rb +11 -8
- data/spec/mongo/session_spec.rb +38 -4
- data/spec/mongo/session_transaction_spec.rb +7 -12
- data/spec/mongo/socket/ssl_spec.rb +180 -103
- data/spec/mongo/socket/tcp_spec.rb +6 -11
- data/spec/mongo/socket/unix_spec.rb +5 -2
- data/spec/mongo/socket_spec.rb +14 -11
- data/spec/mongo/srv/monitor_spec.rb +233 -0
- data/spec/mongo/srv/result_spec.rb +57 -0
- data/spec/mongo/timeout_spec.rb +42 -0
- data/spec/mongo/tls_context_hooks_spec.rb +40 -0
- data/spec/mongo/uri/srv_protocol_spec.rb +95 -58
- data/spec/mongo/uri_option_parsing_spec.rb +14 -19
- data/spec/mongo/uri_spec.rb +253 -54
- data/spec/mongo/utils_spec.rb +56 -0
- data/spec/mongo/write_concern/acknowledged_spec.rb +3 -0
- data/spec/mongo/write_concern/unacknowledged_spec.rb +3 -0
- data/spec/mongo/write_concern_spec.rb +16 -1
- data/spec/runners/auth.rb +140 -0
- data/spec/runners/change_streams/outcome.rb +45 -0
- data/spec/runners/change_streams/spec.rb +60 -0
- data/spec/runners/change_streams/test.rb +232 -0
- data/spec/{support → runners}/cmap/verifier.rb +8 -6
- data/spec/{support → runners}/cmap.rb +29 -23
- data/spec/{support → runners}/command_monitoring.rb +10 -43
- data/spec/runners/connection_string.rb +381 -0
- data/spec/{support/transactions → runners/crud}/context.rb +12 -15
- data/spec/{support → runners}/crud/operation.rb +187 -58
- data/spec/{support → runners}/crud/outcome.rb +4 -1
- data/spec/runners/crud/requirement.rb +133 -0
- data/spec/{support → runners}/crud/spec.rb +20 -16
- data/spec/{support → runners}/crud/test.rb +11 -26
- data/spec/runners/crud/test_base.rb +53 -0
- data/spec/{support → runners}/crud/verifier.rb +40 -13
- data/spec/{support → runners}/crud.rb +33 -11
- data/spec/{support → runners}/gridfs.rb +8 -8
- data/spec/runners/read_write_concern_document.rb +70 -0
- data/spec/runners/sdam/verifier.rb +35 -11
- data/spec/{support/server_discovery_and_monitoring.rb → runners/sdam.rb} +51 -32
- data/spec/runners/server_selection.rb +365 -0
- data/spec/{support → runners}/server_selection_rtt.rb +8 -8
- data/spec/runners/transactions/operation.rb +328 -0
- data/spec/{support → runners}/transactions/spec.rb +4 -1
- data/spec/runners/transactions/test.rb +326 -0
- data/spec/{support → runners}/transactions.rb +19 -19
- data/spec/runners/unified/assertions.rb +282 -0
- data/spec/runners/unified/change_stream_operations.rb +29 -0
- data/spec/runners/unified/crud_operations.rb +206 -0
- data/spec/runners/unified/ddl_operations.rb +106 -0
- data/spec/runners/unified/entity_map.rb +42 -0
- data/spec/runners/unified/error.rb +28 -0
- data/spec/runners/unified/event_subscriber.rb +104 -0
- data/spec/runners/unified/exceptions.rb +24 -0
- data/spec/runners/unified/grid_fs_operations.rb +58 -0
- data/spec/runners/unified/support_operations.rb +253 -0
- data/spec/runners/unified/test.rb +423 -0
- data/spec/runners/unified/test_group.rb +31 -0
- data/spec/runners/unified/using_hash.rb +34 -0
- data/spec/runners/unified.rb +99 -0
- data/spec/shared/LICENSE +20 -0
- data/spec/shared/bin/get-mongodb-download-url +17 -0
- data/spec/shared/bin/s3-copy +45 -0
- data/spec/shared/bin/s3-upload +69 -0
- data/spec/shared/lib/mrss/child_process_helper.rb +80 -0
- data/spec/shared/lib/mrss/cluster_config.rb +226 -0
- data/spec/shared/lib/mrss/constraints.rb +379 -0
- data/spec/shared/lib/mrss/docker_runner.rb +271 -0
- data/spec/shared/lib/mrss/lite_constraints.rb +191 -0
- data/spec/shared/lib/mrss/server_version_registry.rb +115 -0
- data/spec/shared/lib/mrss/spec_organizer.rb +179 -0
- data/spec/shared/lib/mrss/utils.rb +15 -0
- data/spec/shared/share/Dockerfile.erb +322 -0
- data/spec/shared/share/haproxy-1.conf +16 -0
- data/spec/shared/share/haproxy-2.conf +17 -0
- data/spec/shared/shlib/distro.sh +73 -0
- data/spec/shared/shlib/server.sh +317 -0
- data/spec/shared/shlib/set_env.sh +131 -0
- data/spec/solo/clean_exit_spec.rb +24 -0
- data/spec/spec_helper.rb +15 -7
- data/spec/spec_tests/auth_spec.rb +58 -0
- data/spec/spec_tests/change_streams_spec.rb +58 -5
- data/spec/spec_tests/change_streams_unified_spec.rb +13 -0
- data/spec/spec_tests/client_side_encryption_spec.rb +14 -0
- data/spec/spec_tests/cmap_spec.rb +67 -8
- data/spec/spec_tests/collection_management_spec.rb +13 -0
- data/spec/spec_tests/command_monitoring_spec.rb +51 -33
- data/spec/spec_tests/command_monitoring_unified_spec.rb +13 -0
- data/spec/spec_tests/connection_string_spec.rb +6 -83
- data/spec/spec_tests/crud_spec.rb +6 -1
- data/spec/spec_tests/crud_unified_spec.rb +13 -0
- data/spec/spec_tests/data/auth/connection-string.yml +366 -0
- data/spec/spec_tests/data/change_streams/change-streams-errors.yml +30 -5
- data/spec/spec_tests/data/change_streams/change-streams-resume-allowlist.yml +1173 -0
- data/spec/spec_tests/data/change_streams/change-streams-resume-errorLabels.yml +1105 -0
- data/spec/spec_tests/data/change_streams/change-streams.yml +83 -16
- data/spec/spec_tests/data/change_streams_unified/change-streams.yml +72 -0
- data/spec/spec_tests/data/client_side_encryption/aggregate.yml +134 -0
- data/spec/spec_tests/data/client_side_encryption/badQueries.yml +526 -0
- data/spec/spec_tests/data/client_side_encryption/badSchema.yml +73 -0
- data/spec/spec_tests/data/client_side_encryption/basic.yml +116 -0
- data/spec/spec_tests/data/client_side_encryption/bulk.yml +88 -0
- data/spec/spec_tests/data/client_side_encryption/bypassAutoEncryption.yml +100 -0
- data/spec/spec_tests/data/client_side_encryption/bypassedCommand.yml +42 -0
- data/spec/spec_tests/data/client_side_encryption/count.yml +61 -0
- data/spec/spec_tests/data/client_side_encryption/countDocuments.yml +59 -0
- data/spec/spec_tests/data/client_side_encryption/delete.yml +105 -0
- data/spec/spec_tests/data/client_side_encryption/distinct.yml +73 -0
- data/spec/spec_tests/data/client_side_encryption/explain.yml +64 -0
- data/spec/spec_tests/data/client_side_encryption/find.yml +119 -0
- data/spec/spec_tests/data/client_side_encryption/findOneAndDelete.yml +57 -0
- data/spec/spec_tests/data/client_side_encryption/findOneAndReplace.yml +57 -0
- data/spec/spec_tests/data/client_side_encryption/findOneAndUpdate.yml +57 -0
- data/spec/spec_tests/data/client_side_encryption/getMore.yml +68 -0
- data/spec/spec_tests/data/client_side_encryption/insert.yml +102 -0
- data/spec/spec_tests/data/client_side_encryption/keyAltName.yml +71 -0
- data/spec/spec_tests/data/client_side_encryption/localKMS.yml +54 -0
- data/spec/spec_tests/data/client_side_encryption/localSchema.yml +72 -0
- data/spec/spec_tests/data/client_side_encryption/malformedCiphertext.yml +69 -0
- data/spec/spec_tests/data/client_side_encryption/maxWireVersion.yml +20 -0
- data/spec/spec_tests/data/client_side_encryption/missingKey.yml +49 -0
- data/spec/spec_tests/data/client_side_encryption/replaceOne.yml +64 -0
- data/spec/spec_tests/data/client_side_encryption/types.yml +527 -0
- data/spec/spec_tests/data/client_side_encryption/unsupportedCommand.yml +25 -0
- data/spec/spec_tests/data/client_side_encryption/updateMany.yml +77 -0
- data/spec/spec_tests/data/client_side_encryption/updateOne.yml +171 -0
- data/spec/spec_tests/data/cmap/connection-must-have-id.yml +6 -0
- data/spec/spec_tests/data/cmap/connection-must-order-ids.yml +6 -0
- data/spec/spec_tests/data/cmap/pool-checkin-destroy-closed.yml +3 -0
- data/spec/spec_tests/data/cmap/pool-checkin-destroy-stale.yml +3 -0
- data/spec/spec_tests/data/cmap/pool-checkin-make-available.yml +3 -0
- data/spec/spec_tests/data/cmap/pool-checkin.yml +1 -0
- data/spec/spec_tests/data/cmap/pool-checkout-connection.yml +8 -2
- data/spec/spec_tests/data/cmap/pool-checkout-error-closed.yml +9 -1
- data/spec/spec_tests/data/cmap/pool-checkout-multiple.yml +3 -0
- data/spec/spec_tests/data/cmap/pool-checkout-no-idle.yml +4 -0
- data/spec/spec_tests/data/cmap/pool-checkout-no-stale.yml +4 -0
- data/spec/spec_tests/data/cmap/pool-close-destroy-conns.yml +2 -0
- data/spec/spec_tests/data/cmap/pool-create-max-size.yml +15 -0
- data/spec/spec_tests/data/cmap/pool-create-min-size.yml +7 -0
- data/spec/spec_tests/data/cmap/pool-create-with-options.yml +1 -0
- data/spec/spec_tests/data/cmap/wait-queue-fairness.yml +31 -1
- data/spec/spec_tests/data/cmap/wait-queue-timeout.yml +5 -0
- data/spec/spec_tests/data/collection_management/timeseries-collection.yml +129 -0
- data/spec/spec_tests/data/command_monitoring/insertMany.yml +1 -1
- data/spec/spec_tests/data/command_monitoring_unified/redacted-commands.yml +340 -0
- data/spec/spec_tests/data/connection_string/invalid-uris.yml +20 -0
- data/spec/spec_tests/data/connection_string/valid-auth.yml +16 -0
- data/spec/spec_tests/data/connection_string/valid-warnings.yml +50 -30
- data/spec/spec_tests/data/crud/write/bulkWrite.yml +26 -22
- data/spec/spec_tests/data/crud/write/insertMany.yml +26 -22
- data/spec/spec_tests/data/crud_unified/estimatedDocumentCount.yml +267 -0
- data/spec/spec_tests/data/crud_unified/updateWithPipelines.yml +305 -0
- data/spec/spec_tests/data/crud_v2/aggregate-merge.yml +1 -1
- data/spec/spec_tests/data/crud_v2/aggregate-out-readConcern.yml +1 -0
- data/spec/spec_tests/data/crud_v2/bulkWrite-arrayFilters.yml +33 -11
- data/spec/spec_tests/data/crud_v2/bulkWrite-delete-hint-clientError.yml +63 -0
- data/spec/spec_tests/data/crud_v2/bulkWrite-delete-hint-serverError.yml +92 -0
- data/spec/spec_tests/data/crud_v2/bulkWrite-delete-hint.yml +103 -0
- data/spec/spec_tests/data/crud_v2/bulkWrite-update-hint-clientError.yml +90 -0
- data/spec/spec_tests/data/crud_v2/bulkWrite-update-hint-serverError.yml +147 -0
- data/spec/spec_tests/data/crud_v2/bulkWrite-update-hint.yml +164 -0
- data/spec/spec_tests/data/crud_v2/db-aggregate.yml +1 -0
- data/spec/spec_tests/data/crud_v2/deleteMany-hint-clientError.yml +43 -0
- data/spec/spec_tests/data/crud_v2/deleteMany-hint-serverError.yml +62 -0
- data/spec/spec_tests/data/crud_v2/deleteMany-hint.yml +58 -0
- data/spec/spec_tests/data/crud_v2/deleteOne-hint-clientError.yml +41 -0
- data/spec/spec_tests/data/crud_v2/deleteOne-hint-serverError.yml +60 -0
- data/spec/spec_tests/data/crud_v2/deleteOne-hint.yml +57 -0
- data/spec/spec_tests/data/crud_v2/find-allowdiskuse-clientError.yml +28 -0
- data/spec/spec_tests/data/crud_v2/find-allowdiskuse-serverError.yml +44 -0
- data/spec/spec_tests/data/crud_v2/find-allowdiskuse.yml +50 -0
- data/spec/spec_tests/data/crud_v2/findOneAndDelete-hint-clientError.yml +45 -0
- data/spec/spec_tests/data/crud_v2/findOneAndDelete-hint-serverError.yml +60 -0
- data/spec/spec_tests/data/crud_v2/findOneAndDelete-hint.yml +56 -0
- data/spec/spec_tests/data/crud_v2/findOneAndReplace-hint-clientError.yml +40 -0
- data/spec/spec_tests/data/crud_v2/findOneAndReplace-hint-serverError.yml +59 -0
- data/spec/spec_tests/data/crud_v2/findOneAndReplace-hint.yml +55 -0
- data/spec/spec_tests/data/crud_v2/findOneAndUpdate-hint-clientError.yml +40 -0
- data/spec/spec_tests/data/crud_v2/findOneAndUpdate-hint-serverError.yml +58 -0
- data/spec/spec_tests/data/crud_v2/findOneAndUpdate-hint.yml +55 -0
- data/spec/spec_tests/data/crud_v2/replaceOne-hint.yml +61 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-bulkWrite-delete-hint-clientError.yml +60 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-bulkWrite-update-hint-clientError.yml +88 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-deleteMany-hint-clientError.yml +40 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-deleteOne-hint-clientError.yml +38 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-findOneAndDelete-hint-clientError.yml +42 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-findOneAndReplace-hint-clientError.yml +40 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-findOneAndUpdate-hint-clientError.yml +40 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-replaceOne-hint-clientError.yml +40 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-updateMany-hint-clientError.yml +43 -0
- data/spec/spec_tests/data/crud_v2/unacknowledged-updateOne-hint-clientError.yml +40 -0
- data/spec/spec_tests/data/crud_v2/updateMany-hint-clientError.yml +45 -0
- data/spec/spec_tests/data/crud_v2/updateMany-hint-serverError.yml +66 -0
- data/spec/spec_tests/data/crud_v2/updateMany-hint.yml +65 -0
- data/spec/spec_tests/data/crud_v2/updateOne-hint-clientError.yml +43 -0
- data/spec/spec_tests/data/crud_v2/updateOne-hint-serverError.yml +62 -0
- data/spec/spec_tests/data/crud_v2/updateOne-hint.yml +61 -0
- data/spec/spec_tests/data/crud_v2/updateWithPipelines.yml +65 -0
- data/spec/spec_tests/data/dns_seedlist_discovery/direct-connection-false.yml +10 -0
- data/spec/spec_tests/data/dns_seedlist_discovery/direct-connection-true.yml +5 -0
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/MaxStalenessTooSmall.yml +15 -0
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/NoKnownServers.yml +4 -3
- data/spec/spec_tests/data/max_staleness/Unknown/SmallMaxStaleness.yml +1 -0
- data/spec/spec_tests/data/read_write_concern/connection-string/read-concern.yml +32 -0
- data/spec/spec_tests/data/read_write_concern/connection-string/write-concern.yml +79 -0
- data/spec/spec_tests/data/read_write_concern/document/read-concern.yml +37 -0
- data/spec/spec_tests/data/read_write_concern/document/write-concern.yml +100 -0
- data/spec/spec_tests/data/read_write_concern/operation/default-write-concern-2.6.yml +215 -0
- data/spec/spec_tests/data/read_write_concern/operation/default-write-concern-3.2.yml +58 -0
- data/spec/spec_tests/data/read_write_concern/operation/default-write-concern-3.4.yml +95 -0
- data/spec/spec_tests/data/read_write_concern/operation/default-write-concern-4.2.yml +36 -0
- data/spec/spec_tests/data/retryable_reads/aggregate-merge.yml +39 -0
- data/spec/spec_tests/data/retryable_reads/aggregate-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/changeStreams-client.watch-serverErrors.yml +8 -7
- data/spec/spec_tests/data/retryable_reads/changeStreams-client.watch.yml +2 -1
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch-serverErrors.yml +8 -7
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch.yml +2 -1
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.watch-serverErrors.yml +8 -7
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.watch.yml +2 -1
- data/spec/spec_tests/data/retryable_reads/count-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/countDocuments-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/distinct-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount-4.9.yml +60 -0
- data/spec/spec_tests/data/retryable_reads/{estimatedDocumentCount.yml → estimatedDocumentCount-pre4.9.yml} +2 -0
- data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount-serverErrors-4.9.yml +146 -0
- data/spec/spec_tests/data/retryable_reads/{estimatedDocumentCount-serverErrors.yml → estimatedDocumentCount-serverErrors-pre4.9.yml} +4 -2
- data/spec/spec_tests/data/retryable_reads/find-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/findOne-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/gridfs-download-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/gridfs-downloadByName-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/listCollectionNames-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/listCollectionObjects-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/listCollections-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/listDatabaseNames-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/listDatabaseObjects-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/listDatabases-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/listIndexNames-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_reads/listIndexNames.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/listIndexes-serverErrors.yml +2 -2
- data/spec/spec_tests/data/retryable_writes/bulkWrite-errorLabels.yml +77 -0
- data/spec/spec_tests/data/retryable_writes/bulkWrite-serverErrors.yml +37 -0
- data/spec/spec_tests/data/retryable_writes/bulkWrite.yml +30 -24
- data/spec/spec_tests/data/retryable_writes/deleteOne-errorLabels.yml +48 -0
- data/spec/spec_tests/data/retryable_writes/deleteOne-serverErrors.yml +22 -0
- data/spec/spec_tests/data/retryable_writes/findOneAndDelete-errorLabels.yml +49 -0
- data/spec/spec_tests/data/retryable_writes/findOneAndDelete-serverErrors.yml +23 -0
- data/spec/spec_tests/data/retryable_writes/findOneAndReplace-errorLabels.yml +52 -0
- data/spec/spec_tests/data/retryable_writes/findOneAndReplace-serverErrors.yml +25 -0
- data/spec/spec_tests/data/retryable_writes/findOneAndUpdate-errorLabels.yml +52 -0
- data/spec/spec_tests/data/retryable_writes/findOneAndUpdate-serverErrors.yml +24 -0
- data/spec/spec_tests/data/retryable_writes/insertMany-errorLabels.yml +54 -0
- data/spec/spec_tests/data/retryable_writes/insertMany-serverErrors.yml +24 -0
- data/spec/spec_tests/data/retryable_writes/insertOne-errorLabels.yml +44 -0
- data/spec/spec_tests/data/retryable_writes/insertOne-serverErrors.yml +94 -3
- data/spec/spec_tests/data/retryable_writes/replaceOne-errorLabels.yml +53 -0
- data/spec/spec_tests/data/retryable_writes/replaceOne-serverErrors.yml +23 -0
- data/spec/spec_tests/data/retryable_writes/updateOne-errorLabels.yml +53 -0
- data/spec/spec_tests/data/retryable_writes/updateOne-serverErrors.yml +23 -0
- data/spec/spec_tests/data/sdam/errors/error_handling_handshake.yml +55 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-network-error.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-network-timeout-error.yml +38 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-InterruptedAtShutdown.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-InterruptedDueToReplStateChange.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-LegacyNotPrimary.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-NotPrimaryNoSecondaryOk.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-NotPrimaryOrSecondary.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-NotWritablePrimary.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-PrimarySteppedDown.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-greater-ShutdownInProgress.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-InterruptedAtShutdown.yml +52 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-InterruptedDueToReplStateChange.yml +52 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-LegacyNotPrimary.yml +52 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-NotPrimaryNoSecondaryOk.yml +52 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-NotPrimaryOrSecondary.yml +52 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-NotWritablePrimary.yml +52 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-PrimarySteppedDown.yml +52 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-missing-ShutdownInProgress.yml +52 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-InterruptedAtShutdown.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-InterruptedDueToReplStateChange.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-LegacyNotPrimary.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-NotPrimaryNoSecondaryOk.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-NotPrimaryOrSecondary.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-NotWritablePrimary.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-PrimarySteppedDown.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/non-stale-topologyVersion-proccessId-changed-ShutdownInProgress.yml +61 -0
- data/spec/spec_tests/data/sdam/errors/post-42-InterruptedAtShutdown.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/post-42-InterruptedDueToReplStateChange.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/post-42-LegacyNotPrimary.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/post-42-NotPrimaryNoSecondaryOk.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/post-42-NotPrimaryOrSecondary.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/post-42-NotWritablePrimary.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/post-42-PrimarySteppedDown.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/post-42-ShutdownInProgress.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/pre-42-InterruptedAtShutdown.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/pre-42-InterruptedDueToReplStateChange.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/pre-42-LegacyNotPrimary.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/pre-42-NotPrimaryNoSecondaryOk.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/pre-42-NotPrimaryOrSecondary.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/pre-42-NotWritablePrimary.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/pre-42-PrimarySteppedDown.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/pre-42-ShutdownInProgress.yml +47 -0
- data/spec/spec_tests/data/sdam/errors/prefer-error-code.yml +54 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-InterruptedAtShutdown.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-InterruptedDueToReplStateChange.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-NotPrimaryNoSecondaryOk.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-NotPrimaryOrSecondary.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-NotWritablePrimary.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-PrimarySteppedDown.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-ShutdownInProgress.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-InterruptedAtShutdown.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-InterruptedDueToReplStateChange.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-LegacyNotPrimary.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-NotPrimaryNoSecondaryOk.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-NotPrimaryOrSecondary.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-NotWritablePrimary.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-PrimarySteppedDown.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-ShutdownInProgress.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-network.yml +82 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-afterHandshakeCompletes-timeout.yml +82 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-InterruptedAtShutdown.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-InterruptedDueToReplStateChange.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-LegacyNotPrimary.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-NotPrimaryNoSecondaryOk.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-NotPrimaryOrSecondary.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-NotWritablePrimary.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-PrimarySteppedDown.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-ShutdownInProgress.yml +91 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-network.yml +82 -0
- data/spec/spec_tests/data/sdam/errors/stale-generation-beforeHandshakeCompletes-timeout.yml +82 -0
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-InterruptedAtShutdown.yml +65 -0
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-InterruptedDueToReplStateChange.yml +65 -0
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-LegacyNotPrimary.yml +65 -0
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-NotPrimaryNoSecondaryOk.yml +65 -0
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-NotPrimaryOrSecondary.yml +65 -0
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-NotWritablePrimary.yml +65 -0
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-PrimarySteppedDown.yml +65 -0
- data/spec/spec_tests/data/sdam/errors/stale-topologyVersion-ShutdownInProgress.yml +65 -0
- data/spec/spec_tests/data/sdam/errors/write_errors_ignored.yml +42 -0
- data/spec/spec_tests/data/sdam/rs/compatible.yml +6 -2
- data/spec/spec_tests/data/sdam/rs/compatible_unknown.yml +4 -1
- data/spec/spec_tests/data/sdam/rs/discover_arbiters.yml +4 -3
- data/spec/spec_tests/data/sdam/rs/discover_arbiters_replicaset.yml +44 -0
- data/spec/spec_tests/data/sdam/rs/discover_ghost.yml +36 -0
- data/spec/spec_tests/data/sdam/rs/{ghost_discovered.yml → discover_ghost_replicaset.yml} +3 -2
- data/spec/spec_tests/data/sdam/rs/discover_hidden.yml +51 -0
- data/spec/spec_tests/data/sdam/rs/discover_hidden_replicaset.yml +51 -0
- data/spec/spec_tests/data/sdam/rs/discover_passives.yml +6 -4
- data/spec/spec_tests/data/sdam/rs/discover_passives_replicaset.yml +83 -0
- data/spec/spec_tests/data/sdam/rs/discover_primary.yml +4 -3
- data/spec/spec_tests/data/sdam/rs/discover_primary_replicaset.yml +43 -0
- data/spec/spec_tests/data/sdam/rs/discover_rsother.yml +50 -0
- data/spec/spec_tests/data/sdam/rs/{rsother_discovered.yml → discover_rsother_replicaset.yml} +5 -3
- data/spec/spec_tests/data/sdam/rs/discover_secondary.yml +4 -3
- data/spec/spec_tests/data/sdam/rs/discover_secondary_replicaset.yml +44 -0
- data/spec/spec_tests/data/sdam/rs/discovery.yml +8 -4
- data/spec/spec_tests/data/sdam/rs/equal_electionids.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/hosts_differ_from_seeds.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/incompatible_arbiter.yml +5 -1
- data/spec/spec_tests/data/sdam/rs/incompatible_ghost.yml +7 -5
- data/spec/spec_tests/data/sdam/rs/incompatible_other.yml +6 -2
- data/spec/spec_tests/data/sdam/rs/ls_timeout.yml +12 -6
- data/spec/spec_tests/data/sdam/rs/member_reconfig.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/member_standalone.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/new_primary.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/new_primary_new_electionid.yml +6 -3
- data/spec/spec_tests/data/sdam/rs/new_primary_new_setversion.yml +6 -3
- data/spec/spec_tests/data/sdam/rs/new_primary_wrong_set_name.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/non_rs_member.yml +1 -0
- data/spec/spec_tests/data/sdam/rs/normalize_case.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/normalize_case_me.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/null_election_id.yml +8 -4
- data/spec/spec_tests/data/sdam/rs/primary_becomes_ghost.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/primary_becomes_mongos.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/primary_becomes_standalone.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/primary_changes_set_name.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/primary_disconnect.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/primary_disconnect_electionid.yml +10 -5
- data/spec/spec_tests/data/sdam/rs/primary_disconnect_setversion.yml +10 -5
- data/spec/spec_tests/data/sdam/rs/primary_hint_from_secondary_with_mismatched_me.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/primary_mismatched_me.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/primary_mismatched_me_not_removed.yml +75 -0
- data/spec/spec_tests/data/sdam/rs/primary_reports_new_member.yml +8 -4
- data/spec/spec_tests/data/sdam/rs/primary_to_no_primary_mismatched_me.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/primary_wrong_set_name.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/repeated.yml +105 -0
- data/spec/spec_tests/data/sdam/rs/replicaset_rsnp.yml +21 -0
- data/spec/spec_tests/data/sdam/rs/response_from_removed.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/ruby_primary_address_change.yml +31 -0
- data/spec/spec_tests/data/sdam/rs/{secondary_wrong_set_name_with_primary_second.yml → ruby_secondary_wrong_set_name_with_primary_second.yml} +0 -0
- data/spec/spec_tests/data/sdam/rs/sec_not_auth.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/secondary_ignore_ok_0.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/secondary_mismatched_me.yml +5 -3
- data/spec/spec_tests/data/sdam/rs/secondary_wrong_set_name.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/secondary_wrong_set_name_with_primary.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/setversion_without_electionid.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/stepdown_change_set_name.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/too_new.yml +6 -2
- data/spec/spec_tests/data/sdam/rs/too_old.yml +4 -2
- data/spec/spec_tests/data/sdam/rs/topology_version_equal.yml +68 -0
- data/spec/spec_tests/data/sdam/rs/topology_version_greater.yml +194 -0
- data/spec/spec_tests/data/sdam/rs/topology_version_less.yml +64 -0
- data/spec/spec_tests/data/sdam/rs/unexpected_mongos.yml +2 -1
- data/spec/spec_tests/data/sdam/rs/use_setversion_without_electionid.yml +6 -3
- data/spec/spec_tests/data/sdam/rs/wrong_set_name.yml +2 -1
- data/spec/spec_tests/data/sdam/sharded/compatible.yml +4 -2
- data/spec/spec_tests/data/sdam/sharded/discover_single_mongos.yml +24 -0
- data/spec/spec_tests/data/sdam/sharded/ls_timeout_mongos.yml +9 -5
- data/spec/spec_tests/data/sdam/sharded/mongos_disconnect.yml +6 -3
- data/spec/spec_tests/data/sdam/sharded/multiple_mongoses.yml +4 -2
- data/spec/spec_tests/data/sdam/sharded/non_mongos_removed.yml +4 -2
- data/spec/spec_tests/data/sdam/sharded/ruby_primary_different_address.yml +21 -0
- data/spec/spec_tests/data/sdam/sharded/ruby_primary_mismatched_me.yml +22 -0
- data/spec/spec_tests/data/sdam/sharded/too_new.yml +4 -2
- data/spec/spec_tests/data/sdam/sharded/too_old.yml +4 -2
- data/spec/spec_tests/data/sdam/single/compatible.yml +2 -1
- data/spec/spec_tests/data/sdam/single/direct_connection_external_ip.yml +3 -2
- data/spec/spec_tests/data/sdam/single/direct_connection_mongos.yml +4 -3
- data/spec/spec_tests/data/sdam/single/direct_connection_replicaset.yml +23 -0
- data/spec/spec_tests/data/sdam/single/direct_connection_rsarbiter.yml +4 -3
- data/spec/spec_tests/data/sdam/single/direct_connection_rsprimary.yml +4 -3
- data/spec/spec_tests/data/sdam/single/direct_connection_rssecondary.yml +4 -3
- data/spec/spec_tests/data/sdam/single/direct_connection_standalone.yml +4 -3
- data/spec/spec_tests/data/sdam/single/{unavailable_seed.yml → direct_connection_unavailable_seed.yml} +2 -2
- data/spec/spec_tests/data/sdam/single/direct_connection_wrong_set_name.yml +40 -0
- data/spec/spec_tests/data/sdam/single/discover_standalone.yml +35 -0
- data/spec/spec_tests/data/sdam/single/discover_unavailable_seed.yml +28 -0
- data/spec/spec_tests/data/sdam/single/ls_timeout_standalone.yml +2 -1
- data/spec/spec_tests/data/sdam/single/not_ok_response.yml +5 -3
- data/spec/spec_tests/data/sdam/single/ruby_primary_different_address.yml +24 -0
- data/spec/spec_tests/data/sdam/single/ruby_primary_mismatched_me.yml +25 -0
- data/spec/spec_tests/data/sdam/single/standalone_removed.yml +2 -1
- data/spec/spec_tests/data/sdam/single/{direct_connection_slave.yml → standalone_using_legacy_hello.yml} +2 -2
- data/spec/spec_tests/data/sdam/single/too_new.yml +2 -1
- data/spec/spec_tests/data/sdam/single/too_old.yml +2 -1
- data/spec/spec_tests/data/sdam/single/too_old_then_upgraded.yml +48 -0
- data/spec/spec_tests/data/sdam_integration/cancel-server-check.yml +96 -0
- data/spec/spec_tests/data/sdam_integration/connectTimeoutMS.yml +88 -0
- data/spec/spec_tests/data/sdam_integration/find-network-error.yml +83 -0
- data/spec/spec_tests/data/sdam_integration/find-shutdown-error.yml +116 -0
- data/spec/spec_tests/data/sdam_integration/hello-command-error.yml +158 -0
- data/spec/spec_tests/data/sdam_integration/hello-network-error.yml +156 -0
- data/spec/spec_tests/data/sdam_integration/hello-timeout.yml +223 -0
- data/spec/spec_tests/data/sdam_integration/insert-network-error.yml +86 -0
- data/spec/spec_tests/data/sdam_integration/insert-shutdown-error.yml +115 -0
- data/spec/spec_tests/data/sdam_integration/rediscover-quickly-after-step-down.yml +98 -0
- data/spec/spec_tests/data/sdam_monitoring/discovered_standalone.yml +2 -4
- data/spec/spec_tests/data/sdam_monitoring/{replica_set_other_seed.yml → replica_set_primary_address_change.yml} +114 -96
- data/spec/spec_tests/data/sdam_monitoring/replica_set_with_me_mismatch.yml +111 -0
- data/spec/spec_tests/data/sdam_monitoring/replica_set_with_no_primary.yml +2 -1
- data/spec/spec_tests/data/sdam_monitoring/replica_set_with_primary.yml +2 -1
- data/spec/spec_tests/data/sdam_monitoring/replica_set_with_primary_removal.yml +22 -18
- data/spec/spec_tests/data/sdam_monitoring/replica_set_with_removal.yml +21 -16
- data/spec/spec_tests/data/sdam_monitoring/required_replica_set.yml +2 -1
- data/spec/spec_tests/data/sdam_monitoring/standalone.yml +3 -3
- data/spec/spec_tests/data/sdam_monitoring/standalone_repeated.yml +2 -2
- data/spec/spec_tests/data/sdam_monitoring/standalone_suppress_equal_description_changes.yml +73 -0
- data/spec/spec_tests/data/sdam_monitoring/standalone_to_rs_with_me_mismatch.yml +90 -0
- data/spec/spec_tests/data/transactions/abort.yml +3 -3
- data/spec/spec_tests/data/transactions/create-collection.yml +131 -0
- data/spec/spec_tests/data/transactions/create-index.yml +152 -0
- data/spec/spec_tests/data/transactions/error-labels.yml +93 -24
- data/spec/spec_tests/data/transactions/mongos-pin-auto.yml +3 -0
- data/spec/spec_tests/data/transactions/mongos-recovery-token.yml +3 -0
- data/spec/spec_tests/data/transactions/pin-mongos.yml +8 -6
- data/spec/spec_tests/data/transactions/read-concern.yml +6 -6
- data/spec/spec_tests/data/transactions/retryable-abort-errorLabels.yml +124 -0
- data/spec/spec_tests/data/transactions/retryable-abort.yml +17 -2
- data/spec/spec_tests/data/transactions/retryable-commit-errorLabels.yml +132 -0
- data/spec/spec_tests/data/transactions/retryable-commit.yml +24 -9
- data/spec/spec_tests/data/transactions/transaction-options-repl.yml +117 -0
- data/spec/spec_tests/data/transactions/transaction-options.yml +14 -121
- data/spec/spec_tests/data/transactions/write-concern.yml +3 -0
- data/spec/spec_tests/data/transactions_api/callback-retry.yml +3 -3
- data/spec/spec_tests/data/transactions_api/transaction-options.yml +11 -12
- data/spec/spec_tests/data/transactions_unified/mongos-unpin.yml +172 -0
- data/spec/spec_tests/data/unified/valid-fail/operation-failure.yml +31 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-change-streams.yml +220 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-command-monitoring.yml +102 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-crud.yml +184 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-gridfs.yml +155 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-retryable-reads.yml +193 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-retryable-writes.yml +210 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-sessions.yml +215 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-transactions-convenient-api.yml +235 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-transactions-mongos-pin-auto.yml +169 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-transactions.yml +170 -0
- data/spec/spec_tests/data/uri_options/auth-options.yml +36 -1
- data/spec/spec_tests/data/uri_options/compression-options.yml +7 -4
- data/spec/spec_tests/data/uri_options/connection-options.yml +43 -0
- data/spec/spec_tests/data/uri_options/read-preference-options.yml +24 -0
- data/spec/spec_tests/data/uri_options/ruby-auth-options.yml +12 -0
- data/spec/spec_tests/data/uri_options/ruby-connection-options.yml +58 -0
- data/spec/spec_tests/data/uri_options/tls-options.yml +233 -6
- data/spec/spec_tests/data/versioned_api/crud-api-version-1-strict.yml +417 -0
- data/spec/spec_tests/data/versioned_api/crud-api-version-1.yml +411 -0
- data/spec/spec_tests/data/versioned_api/runcommand-helper-no-api-version-declared.yml +75 -0
- data/spec/spec_tests/data/versioned_api/test-commands-deprecation-errors.yml +47 -0
- data/spec/spec_tests/data/versioned_api/test-commands-strict-mode.yml +46 -0
- data/spec/spec_tests/data/versioned_api/transaction-handling.yml +128 -0
- data/spec/spec_tests/dns_seedlist_discovery_spec.rb +32 -9
- data/spec/spec_tests/gridfs_spec.rb +5 -0
- data/spec/spec_tests/max_staleness_spec.rb +7 -135
- data/spec/spec_tests/read_write_concern_connection_string_spec.rb +13 -0
- data/spec/spec_tests/read_write_concern_document_spec.rb +77 -0
- data/spec/spec_tests/read_write_concern_operaton_spec.rb +13 -0
- data/spec/spec_tests/retryable_reads_spec.rb +7 -2
- data/spec/spec_tests/retryable_writes_spec.rb +11 -1
- data/spec/spec_tests/sdam_integration_spec.rb +16 -0
- data/spec/spec_tests/sdam_monitoring_spec.rb +15 -6
- data/spec/spec_tests/sdam_spec.rb +78 -9
- data/spec/spec_tests/server_selection_rtt_spec.rb +5 -0
- data/spec/spec_tests/server_selection_spec.rb +7 -110
- data/spec/spec_tests/transactions_api_spec.rb +8 -0
- data/spec/spec_tests/transactions_spec.rb +7 -1
- data/spec/spec_tests/transactions_unified_spec.rb +13 -0
- data/spec/spec_tests/unified_spec.rb +18 -0
- data/spec/spec_tests/uri_options_spec.rb +63 -42
- data/spec/spec_tests/versioned_api_spec.rb +13 -0
- data/spec/stress/cleanup_spec.rb +61 -0
- data/spec/stress/connection_pool_stress_spec.rb +204 -0
- data/spec/stress/connection_pool_timing_spec.rb +184 -0
- data/spec/stress/fork_reconnect_stress_spec.rb +112 -0
- data/spec/stress/push_monitor_close_spec.rb +44 -0
- data/spec/support/authorization.rb +4 -11
- data/spec/support/aws_utils/base.rb +137 -0
- data/spec/support/aws_utils/inspector.rb +227 -0
- data/spec/support/aws_utils/orchestrator.rb +373 -0
- data/spec/support/aws_utils/provisioner.rb +363 -0
- data/spec/support/aws_utils.rb +65 -0
- data/spec/support/background_thread_registry.rb +70 -0
- data/spec/support/certificates/README.md +7 -2
- data/spec/support/certificates/atlas-ocsp-ca.crt +118 -0
- data/spec/support/certificates/atlas-ocsp.crt +152 -0
- data/spec/support/certificates/client-x509.crt +78 -0
- data/spec/support/certificates/client-x509.key +27 -0
- data/spec/support/certificates/client-x509.pem +105 -0
- data/spec/support/certificates/server-second-level-bundle.pem +77 -77
- data/spec/support/certificates/server-second-level.crt +52 -52
- data/spec/support/certificates/server-second-level.key +25 -25
- data/spec/support/certificates/server-second-level.pem +77 -77
- data/spec/support/client_registry.rb +65 -37
- data/spec/support/client_registry_macros.rb +17 -5
- data/spec/support/cluster_tools.rb +15 -5
- data/spec/support/common_shortcuts.rb +239 -6
- data/spec/support/constraints.rb +9 -184
- data/spec/support/crypt/corpus/corpus-key-aws.json +33 -0
- data/spec/support/crypt/corpus/corpus-key-local.json +31 -0
- data/spec/support/crypt/corpus/corpus-schema.json +2057 -0
- data/spec/support/crypt/corpus/corpus.json +3657 -0
- data/spec/support/crypt/corpus/corpus_encrypted.json +4152 -0
- data/spec/support/crypt/data_keys/key_document_aws.json +34 -0
- data/spec/support/crypt/data_keys/key_document_local.json +31 -0
- data/spec/support/crypt/external/external-key.json +31 -0
- data/spec/support/crypt/external/external-schema.json +19 -0
- data/spec/support/crypt/limits/limits-doc.json +102 -0
- data/spec/support/crypt/limits/limits-key.json +31 -0
- data/spec/support/crypt/limits/limits-schema.json +1405 -0
- data/spec/support/crypt/schema_maps/schema_map_aws.json +17 -0
- data/spec/support/crypt/schema_maps/schema_map_aws_key_alt_names.json +12 -0
- data/spec/support/crypt/schema_maps/schema_map_local.json +18 -0
- data/spec/support/crypt/schema_maps/schema_map_local_key_alt_names.json +12 -0
- data/spec/support/crypt.rb +157 -0
- data/spec/support/dns.rb +16 -0
- data/spec/support/event_subscriber.rb +193 -84
- data/spec/support/json_ext_formatter.rb +8 -1
- data/spec/support/keyword_struct.rb +29 -0
- data/spec/support/local_resource_registry.rb +37 -0
- data/spec/support/matchers.rb +39 -1
- data/spec/support/monitoring_ext.rb +3 -0
- data/spec/support/ocsp +1 -0
- data/spec/support/primary_socket.rb +3 -0
- data/spec/support/sdam_formatter_integration.rb +3 -0
- data/spec/support/session_registry.rb +55 -0
- data/spec/support/shared/app_metadata.rb +167 -0
- data/spec/support/shared/protocol.rb +5 -0
- data/spec/support/shared/scram_conversation.rb +103 -0
- data/spec/support/shared/server_selector.rb +99 -4
- data/spec/support/shared/session.rb +34 -23
- data/spec/support/spec_config.rb +292 -56
- data/spec/support/spec_setup.rb +58 -36
- data/spec/support/utils.rb +446 -45
- data.tar.gz.sig +0 -0
- metadata +1626 -683
- metadata.gz.sig +0 -0
- data/lib/mongo/event/description_changed.rb +0 -52
- data/lib/mongo/operation/shared/op_msg_or_list_indexes_command.rb +0 -45
- data/lib/mongo/server/connectable.rb +0 -107
- data/spec/enterprise_auth/kerberos_spec.rb +0 -57
- data/spec/mongo/operation/read_preference_spec.rb +0 -245
- data/spec/spec_tests/data/sdam/sharded/single_mongos.yml +0 -33
- data/spec/support/change_streams/operation.rb +0 -89
- data/spec/support/change_streams.rb +0 -265
- data/spec/support/cluster_config.rb +0 -139
- data/spec/support/connection_string.rb +0 -326
- data/spec/support/crud/requirement.rb +0 -69
- data/spec/support/crud/test_base.rb +0 -22
- data/spec/support/lite_constraints.rb +0 -52
- data/spec/support/sdam_monitoring.rb +0 -89
- data/spec/support/server_selection.rb +0 -153
- data/spec/support/transactions/operation.rb +0 -184
- data/spec/support/transactions/test.rb +0 -252
data/lib/mongo/grid/fs_bucket.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# Copyright (C) 2014-2020 MongoDB Inc.
|
2
5
|
#
|
3
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
7
|
# you may not use this file except in compliance with the License.
|
@@ -36,6 +39,49 @@ module Mongo
|
|
36
39
|
# @since 2.1.0
|
37
40
|
FILES_INDEX = { filename: 1, uploadDate: 1 }.freeze
|
38
41
|
|
42
|
+
# Create the GridFS.
|
43
|
+
#
|
44
|
+
# @example Create the GridFS.
|
45
|
+
# Grid::FSBucket.new(database)
|
46
|
+
#
|
47
|
+
# @param [ Database ] database The database the files reside in.
|
48
|
+
# @param [ Hash ] options The GridFS options.
|
49
|
+
#
|
50
|
+
# @option options [ String ] :bucket_name The prefix for the files and chunks
|
51
|
+
# collections.
|
52
|
+
# @option options [ Integer ] :chunk_size Override the default chunk
|
53
|
+
# size.
|
54
|
+
# @option options [ String ] :fs_name The prefix for the files and chunks
|
55
|
+
# collections.
|
56
|
+
# @option options [ Hash ] :read The read preference options. The hash
|
57
|
+
# may have the following items:
|
58
|
+
# - *:mode* -- read preference specified as a symbol; valid values are
|
59
|
+
# *:primary*, *:primary_preferred*, *:secondary*, *:secondary_preferred*
|
60
|
+
# and *:nearest*.
|
61
|
+
# - *:tag_sets* -- an array of hashes.
|
62
|
+
# - *:local_threshold*.
|
63
|
+
# @option options [ Session ] :session The session to use.
|
64
|
+
# @option options [ Hash ] :write Deprecated. Equivalent to :write_concern
|
65
|
+
# option.
|
66
|
+
# @option options [ Hash ] :write_concern The write concern options.
|
67
|
+
# Can be :w => Integer|String, :fsync => Boolean, :j => Boolean.
|
68
|
+
#
|
69
|
+
# @since 2.0.0
|
70
|
+
def initialize(database, options = {})
|
71
|
+
@database = database
|
72
|
+
@options = options.dup
|
73
|
+
=begin WriteConcern object support
|
74
|
+
if @options[:write_concern].is_a?(WriteConcern::Base)
|
75
|
+
# Cache the instance so that we do not needlessly reconstruct it.
|
76
|
+
@write_concern = @options[:write_concern]
|
77
|
+
@options[:write_concern] = @write_concern.options
|
78
|
+
end
|
79
|
+
=end
|
80
|
+
@options.freeze
|
81
|
+
@chunks_collection = database[chunks_name]
|
82
|
+
@files_collection = database[files_name]
|
83
|
+
end
|
84
|
+
|
39
85
|
# @return [ Collection ] chunks_collection The chunks collection.
|
40
86
|
#
|
41
87
|
# @since 2.0.0
|
@@ -70,6 +116,8 @@ module Mongo
|
|
70
116
|
# @param [ Hash ] selector The selector to use in the find.
|
71
117
|
# @param [ Hash ] options The options for the find.
|
72
118
|
#
|
119
|
+
# @option options [ true, false ] :allow_disk_use Whether the server can
|
120
|
+
# write temporary data to disk while executing the find operation.
|
73
121
|
# @option options [ Integer ] :batch_size The number of documents returned in each batch
|
74
122
|
# of results from MongoDB.
|
75
123
|
# @option options [ Integer ] :limit The max number of docs to return from the query.
|
@@ -131,43 +179,6 @@ module Mongo
|
|
131
179
|
file.id
|
132
180
|
end
|
133
181
|
|
134
|
-
# Create the GridFS.
|
135
|
-
#
|
136
|
-
# @example Create the GridFS.
|
137
|
-
# Grid::FSBucket.new(database)
|
138
|
-
#
|
139
|
-
# @param [ Database ] database The database the files reside in.
|
140
|
-
# @param [ Hash ] options The GridFS options.
|
141
|
-
#
|
142
|
-
# @option options [ String ] :fs_name The prefix for the files and chunks
|
143
|
-
# collections.
|
144
|
-
# @option options [ String ] :bucket_name The prefix for the files and chunks
|
145
|
-
# collections.
|
146
|
-
# @option options [ Integer ] :chunk_size Override the default chunk
|
147
|
-
# size.
|
148
|
-
# @option options [ String ] :read The read preference.
|
149
|
-
# @option options [ Session ] :session The session to use.
|
150
|
-
# @option options [ Hash ] :write Deprecated. Equivalent to :write_concern
|
151
|
-
# option.
|
152
|
-
# @option options [ Hash ] :write_concern The write concern options.
|
153
|
-
# Can be :w => Integer|String, :fsync => Boolean, :j => Boolean.
|
154
|
-
#
|
155
|
-
# @since 2.0.0
|
156
|
-
def initialize(database, options = {})
|
157
|
-
@database = database
|
158
|
-
@options = options.dup
|
159
|
-
=begin WriteConcern object support
|
160
|
-
if @options[:write_concern].is_a?(WriteConcern::Base)
|
161
|
-
# Cache the instance so that we do not needlessly reconstruct it.
|
162
|
-
@write_concern = @options[:write_concern]
|
163
|
-
@options[:write_concern] = @write_concern.options
|
164
|
-
end
|
165
|
-
=end
|
166
|
-
@options.freeze
|
167
|
-
@chunks_collection = database[chunks_name]
|
168
|
-
@files_collection = database[files_name]
|
169
|
-
end
|
170
|
-
|
171
182
|
# Get the prefix for the GridFS
|
172
183
|
#
|
173
184
|
# @example Get the prefix.
|
@@ -230,7 +241,7 @@ module Mongo
|
|
230
241
|
#
|
231
242
|
# @since 2.1.0
|
232
243
|
def open_download_stream(id, options = nil)
|
233
|
-
options =
|
244
|
+
options = Utils.shallow_symbolize_keys(options || {})
|
234
245
|
read_stream(id, **options).tap do |stream|
|
235
246
|
if block_given?
|
236
247
|
begin
|
@@ -376,7 +387,7 @@ module Mongo
|
|
376
387
|
#
|
377
388
|
# @since 2.1.0
|
378
389
|
def open_upload_stream(filename, opts = {})
|
379
|
-
opts =
|
390
|
+
opts = Utils.shallow_symbolize_keys(opts)
|
380
391
|
write_stream(filename, **opts).tap do |stream|
|
381
392
|
if block_given?
|
382
393
|
begin
|
@@ -420,7 +431,10 @@ module Mongo
|
|
420
431
|
open_upload_stream(filename, opts) do |stream|
|
421
432
|
begin
|
422
433
|
stream.write(io)
|
423
|
-
|
434
|
+
# IOError and SystemCallError are for errors reading the io.
|
435
|
+
# Error::SocketError and Error::SocketTimeoutError are for
|
436
|
+
# writing to MongoDB.
|
437
|
+
rescue IOError, SystemCallError, Error::SocketError, Error::SocketTimeoutError
|
424
438
|
begin
|
425
439
|
stream.abort
|
426
440
|
rescue Error::OperationFailure
|
@@ -432,14 +446,26 @@ module Mongo
|
|
432
446
|
|
433
447
|
# Get the read preference.
|
434
448
|
#
|
435
|
-
# @
|
436
|
-
#
|
437
|
-
#
|
438
|
-
#
|
439
|
-
#
|
440
|
-
#
|
449
|
+
# @note This method always returns a BSON::Document instance, even though
|
450
|
+
# the FSBucket constructor specifies the type of :read as a Hash, not
|
451
|
+
# as a BSON::Document.
|
452
|
+
#
|
453
|
+
# @return [ BSON::Document ] The read preference.
|
454
|
+
# The document may have the following fields:
|
455
|
+
# - *:mode* -- read preference specified as a symbol; valid values are
|
456
|
+
# *:primary*, *:primary_preferred*, *:secondary*, *:secondary_preferred*
|
457
|
+
# and *:nearest*.
|
458
|
+
# - *:tag_sets* -- an array of hashes.
|
459
|
+
# - *:local_threshold*.
|
441
460
|
def read_preference
|
442
|
-
@read_preference ||=
|
461
|
+
@read_preference ||= begin
|
462
|
+
pref = options[:read] || database.read_preference
|
463
|
+
if BSON::Document === pref
|
464
|
+
pref
|
465
|
+
else
|
466
|
+
BSON::Document.new(pref)
|
467
|
+
end
|
468
|
+
end
|
443
469
|
end
|
444
470
|
|
445
471
|
# Get the write concern.
|
@@ -1,4 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# Copyright (C) 2014-2020 MongoDB Inc.
|
2
5
|
#
|
3
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
7
|
# you may not use this file except in compliance with the License.
|
@@ -133,16 +136,28 @@ module Mongo
|
|
133
136
|
!@open
|
134
137
|
end
|
135
138
|
|
136
|
-
# Get the read preference
|
137
|
-
#
|
138
|
-
# @example Get the read preference.
|
139
|
-
# stream.read_preference
|
139
|
+
# Get the read preference.
|
140
140
|
#
|
141
|
-
# @
|
141
|
+
# @note This method always returns a BSON::Document instance, even
|
142
|
+
# though the constructor specifies the type of :read as a Hash, not
|
143
|
+
# as a BSON::Document.
|
142
144
|
#
|
143
|
-
# @
|
145
|
+
# @return [ BSON::Document ] The read preference.
|
146
|
+
# The document may have the following fields:
|
147
|
+
# - *:mode* -- read preference specified as a symbol; valid values are
|
148
|
+
# *:primary*, *:primary_preferred*, *:secondary*, *:secondary_preferred*
|
149
|
+
# and *:nearest*.
|
150
|
+
# - *:tag_sets* -- an array of hashes.
|
151
|
+
# - *:local_threshold*.
|
144
152
|
def read_preference
|
145
|
-
@read_preference ||=
|
153
|
+
@read_preference ||= begin
|
154
|
+
pref = options[:read] || fs.read_preference
|
155
|
+
if BSON::Document === pref
|
156
|
+
pref
|
157
|
+
else
|
158
|
+
BSON::Document.new(pref)
|
159
|
+
end
|
160
|
+
end
|
146
161
|
end
|
147
162
|
|
148
163
|
# Get the files collection file information document for the file
|
@@ -1,4 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# Copyright (C) 2014-2020 MongoDB Inc.
|
2
5
|
#
|
3
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
7
|
# you may not use this file except in compliance with the License.
|
data/lib/mongo/grid/stream.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# Copyright (C) 2014-2020 MongoDB Inc.
|
2
5
|
#
|
3
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
7
|
# you may not use this file except in compliance with the License.
|
data/lib/mongo/grid.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# Copyright (C) 2014-2020 MongoDB Inc.
|
2
5
|
#
|
3
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
7
|
# you may not use this file except in compliance with the License.
|
data/lib/mongo/id.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# Copyright (C) 2016-2020 MongoDB Inc.
|
2
5
|
#
|
3
6
|
# Licensed under the Apache License, Version 2.0 (the 'License');
|
4
7
|
# you may not use this file except in compliance with the License.
|
data/lib/mongo/index/view.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# Copyright (C) 2014-2020 MongoDB Inc.
|
2
5
|
#
|
3
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
7
|
# you may not use this file except in compliance with the License.
|
@@ -120,6 +123,14 @@ module Mongo
|
|
120
123
|
# a geo index.
|
121
124
|
# @option options [ Hash ] :partial_filter_expression Specify a filter for a partial
|
122
125
|
# index.
|
126
|
+
# @option options [ Boolean ] :hidden When :hidden is true, this index will
|
127
|
+
# exist on the collection but not be used by the query planner when
|
128
|
+
# executing operations.
|
129
|
+
# @option options [ String | Integer ] :commit_quorum Specify how many
|
130
|
+
# data-bearing members of a replica set, including the primary, must
|
131
|
+
# complete the index builds successfully before the primary marks
|
132
|
+
# the indexes as ready.
|
133
|
+
# @option options [ Session ] :session The session to use for the operation.
|
123
134
|
#
|
124
135
|
# @note Note that the options listed may be subset of those available.
|
125
136
|
# See the MongoDB documentation for a full list of supported options by server version.
|
@@ -128,7 +139,18 @@ module Mongo
|
|
128
139
|
#
|
129
140
|
# @since 2.0.0
|
130
141
|
def create_one(keys, options = {})
|
131
|
-
|
142
|
+
options = options.dup
|
143
|
+
|
144
|
+
create_options = {}
|
145
|
+
if session = @options[:session]
|
146
|
+
create_options[:session] = session
|
147
|
+
end
|
148
|
+
%i(commit_quorum session).each do |key|
|
149
|
+
if value = options.delete(key)
|
150
|
+
create_options[key] = value
|
151
|
+
end
|
152
|
+
end
|
153
|
+
create_many({ key: keys }.merge(options), create_options)
|
132
154
|
end
|
133
155
|
|
134
156
|
# Creates multiple indexes on the collection.
|
@@ -139,26 +161,67 @@ module Mongo
|
|
139
161
|
# { key: { age: -1 }, background: true }
|
140
162
|
# ])
|
141
163
|
#
|
164
|
+
# @example Create multiple indexes with options.
|
165
|
+
# view.create_many(
|
166
|
+
# { key: { name: 1 }, unique: true },
|
167
|
+
# { key: { age: -1 }, background: true },
|
168
|
+
# { commit_quorum: 'majority' }
|
169
|
+
# )
|
170
|
+
#
|
142
171
|
# @note On MongoDB 3.0.0 and higher, the indexes will be created in
|
143
172
|
# parallel on the server.
|
144
173
|
#
|
145
174
|
# @param [ Array<Hash> ] models The index specifications. Each model MUST
|
146
|
-
# include a :key option
|
175
|
+
# include a :key option, except for the last item in the Array, which
|
176
|
+
# may be a Hash specifying options relevant to the createIndexes operation.
|
177
|
+
# The following options are accepted:
|
178
|
+
# - commit_quorum: Specify how many data-bearing members of a replica set,
|
179
|
+
# including the primary, must complete the index builds successfully
|
180
|
+
# before the primary marks the indexes as ready.
|
181
|
+
# - session: The session to use.
|
147
182
|
#
|
148
183
|
# @return [ Result ] The result of the command.
|
149
184
|
#
|
150
185
|
# @since 2.0.0
|
151
186
|
def create_many(*models)
|
152
|
-
|
187
|
+
models = models.flatten
|
188
|
+
options = {}
|
189
|
+
if models && !models.last.key?(:key)
|
190
|
+
options = models.pop
|
191
|
+
end
|
192
|
+
|
193
|
+
client.send(:with_session, @options.merge(options)) do |session|
|
153
194
|
server = next_primary(nil, session)
|
195
|
+
|
196
|
+
# While server versions 3.4 and newer generally perform option
|
197
|
+
# validation, there was a bug on server versions 4.2.0 - 4.2.5 where
|
198
|
+
# the server would accept the commitQuorum option and use it internally
|
199
|
+
# (see SERVER-47193). As a result, the drivers specifications require
|
200
|
+
# drivers to perform validation and raise an error when the commitQuorum
|
201
|
+
# option is passed to servers that don't support it.
|
202
|
+
description = server.with_connection { |connection| connection.description }
|
203
|
+
if description.max_wire_version < 9 && options[:commit_quorum]
|
204
|
+
raise Error::UnsupportedOption.commit_quorum_error
|
205
|
+
end
|
206
|
+
|
207
|
+
indexes = normalize_models(models, server)
|
208
|
+
indexes.each do |index|
|
209
|
+
if index[:bucketSize] || index['bucketSize']
|
210
|
+
client.log_warn("Haystack indexes (bucketSize index option) are deprecated as of MongoDB 4.4")
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
154
214
|
spec = {
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
215
|
+
indexes: indexes,
|
216
|
+
db_name: database.name,
|
217
|
+
coll_name: collection.name,
|
218
|
+
session: session,
|
219
|
+
commit_quorum: options[:commit_quorum]
|
220
|
+
}
|
221
|
+
|
222
|
+
spec[:write_concern] = write_concern if description.features.collation_enabled?
|
223
|
+
|
224
|
+
Operation::CreateIndex.new(spec).execute(server, context: Operation::Context.new(client: client, session: session))
|
162
225
|
end
|
163
226
|
end
|
164
227
|
|
@@ -235,8 +298,8 @@ module Mongo
|
|
235
298
|
session: session
|
236
299
|
}
|
237
300
|
server = next_primary(nil, session)
|
238
|
-
spec[:write_concern] = write_concern if server.features.collation_enabled?
|
239
|
-
Operation::DropIndex.new(spec).execute(server)
|
301
|
+
spec[:write_concern] = write_concern if server.with_connection { |connection| connection.features }.collation_enabled?
|
302
|
+
Operation::DropIndex.new(spec).execute(server, context: Operation::Context.new(client: client, session: session))
|
240
303
|
end
|
241
304
|
end
|
242
305
|
|
@@ -272,7 +335,7 @@ module Mongo
|
|
272
335
|
end
|
273
336
|
|
274
337
|
def send_initial_query(server, session)
|
275
|
-
initial_query_op(session).execute(server)
|
338
|
+
initial_query_op(session).execute(server, context: Operation::Context.new(client: client, session: session))
|
276
339
|
end
|
277
340
|
|
278
341
|
def with_generated_names(models, server)
|
@@ -286,7 +349,7 @@ module Mongo
|
|
286
349
|
|
287
350
|
def validate_collation!(model, server)
|
288
351
|
if (model[:collation] || model[Operation::COLLATION]) &&
|
289
|
-
!server.features.collation_enabled?
|
352
|
+
!server.with_connection { |connection| connection.features }.collation_enabled?
|
290
353
|
raise Error::UnsupportedCollation.new
|
291
354
|
end
|
292
355
|
end
|
data/lib/mongo/index.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# Copyright (C) 2014-2020 MongoDB Inc.
|
2
5
|
#
|
3
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
7
|
# you may not use this file except in compliance with the License.
|
@@ -49,6 +52,7 @@ module Mongo
|
|
49
52
|
# Specify a geoHaystack index.
|
50
53
|
#
|
51
54
|
# @since 2.0.0
|
55
|
+
# @deprecated
|
52
56
|
GEOHAYSTACK = 'geoHaystack'.freeze
|
53
57
|
|
54
58
|
# Encodes a text index.
|
data/lib/mongo/lint.rb
CHANGED
@@ -1,6 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
1
4
|
module Mongo
|
5
|
+
|
2
6
|
# @api private
|
3
7
|
module Lint
|
8
|
+
|
9
|
+
# Raises LintError if +obj+ is not of type +cls+.
|
10
|
+
def assert_type(obj, cls)
|
11
|
+
return unless enabled?
|
12
|
+
unless obj.is_a?(cls)
|
13
|
+
raise Error::LintError, "Expected #{obj} to be a #{cls}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
module_function :assert_type
|
17
|
+
|
4
18
|
def validate_underscore_read_preference(read_pref)
|
5
19
|
return unless enabled?
|
6
20
|
return if read_pref.nil?
|
data/lib/mongo/loggable.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# Copyright (C) 2014-2020 MongoDB Inc.
|
2
5
|
#
|
3
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
7
|
# you may not use this file except in compliance with the License.
|
@@ -99,7 +102,11 @@ module Mongo
|
|
99
102
|
private
|
100
103
|
|
101
104
|
def format_message(message)
|
102
|
-
format("%s | %s".freeze,
|
105
|
+
format("%s | %s".freeze, _mongo_log_prefix, message)
|
106
|
+
end
|
107
|
+
|
108
|
+
def _mongo_log_prefix
|
109
|
+
(options && options[:log_prefix]) || PREFIX
|
103
110
|
end
|
104
111
|
end
|
105
112
|
end
|
data/lib/mongo/logger.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# Copyright (C) 2014-2020 MongoDB Inc.
|
2
5
|
#
|
3
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
7
|
# you may not use this file except in compliance with the License.
|
@@ -21,7 +24,7 @@ module Mongo
|
|
21
24
|
|
22
25
|
class << self
|
23
26
|
|
24
|
-
# Get the wrapped logger. If none was set will return a default
|
27
|
+
# Get the wrapped logger. If none was set will return a default info
|
25
28
|
# level logger.
|
26
29
|
#
|
27
30
|
# @example Get the wrapped logger.
|
@@ -75,8 +78,8 @@ module Mongo
|
|
75
78
|
private
|
76
79
|
|
77
80
|
def default_logger
|
78
|
-
logger = ::Logger.new(
|
79
|
-
logger.level = ::Logger::
|
81
|
+
logger = ::Logger.new(STDOUT)
|
82
|
+
logger.level = ::Logger::INFO
|
80
83
|
logger
|
81
84
|
end
|
82
85
|
end
|
@@ -1,4 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# Copyright (C) 2019-2020 MongoDB Inc.
|
2
5
|
#
|
3
6
|
# Licensed under the Apache License, Version 2.0 (the 'License');
|
4
7
|
# you may not use this file except in compliance with the License.
|
@@ -1,4 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# Copyright (C) 2015-2020 MongoDB Inc.
|
2
5
|
#
|
3
6
|
# Licensed under the Apache License, Version 2.0 (the 'License');
|
4
7
|
# you may not use this file except in compliance with the License.
|
@@ -54,7 +57,12 @@ module Mongo
|
|
54
57
|
# @since 2.1.0
|
55
58
|
def started(event)
|
56
59
|
if logger.debug?
|
57
|
-
|
60
|
+
_prefix = prefix(event,
|
61
|
+
connection_generation: event.connection_generation,
|
62
|
+
connection_id: event.connection_id,
|
63
|
+
server_connection_id: event.server_connection_id,
|
64
|
+
)
|
65
|
+
log_debug("#{_prefix} | STARTED | #{format_command(event.command)}")
|
58
66
|
end
|
59
67
|
end
|
60
68
|
|
@@ -96,8 +104,20 @@ module Mongo
|
|
96
104
|
end
|
97
105
|
end
|
98
106
|
|
99
|
-
def prefix(event
|
100
|
-
|
107
|
+
def prefix(event, connection_generation: nil, connection_id: nil,
|
108
|
+
server_connection_id: nil
|
109
|
+
)
|
110
|
+
extra = [connection_generation, connection_id].compact.join(':')
|
111
|
+
if extra == ''
|
112
|
+
extra = nil
|
113
|
+
else
|
114
|
+
extra = "conn:#{extra}"
|
115
|
+
end
|
116
|
+
if server_connection_id
|
117
|
+
extra += " sconn:#{server_connection_id}"
|
118
|
+
end
|
119
|
+
"#{event.address.to_s} req:#{event.request_id}#{extra && " #{extra}"} | " +
|
120
|
+
"#{event.database_name}.#{event.command_name}"
|
101
121
|
end
|
102
122
|
|
103
123
|
def truncate(command)
|
@@ -1,4 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# Copyright (C) 2019-2020 MongoDB Inc.
|
2
5
|
#
|
3
6
|
# Licensed under the Apache License, Version 2.0 (the 'License');
|
4
7
|
# you may not use this file except in compliance with the License.
|
@@ -1,4 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# Copyright (C) 2019-2020 MongoDB Inc.
|
2
5
|
#
|
3
6
|
# Licensed under the Apache License, Version 2.0 (the 'License');
|
4
7
|
# you may not use this file except in compliance with the License.
|
@@ -35,6 +38,13 @@ module Mongo
|
|
35
38
|
# @since 2.9.0
|
36
39
|
TIMEOUT = :timeout
|
37
40
|
|
41
|
+
# @return [ Symbol ] CONNECTION_ERROR Indicates that the connection
|
42
|
+
# check out failed due to an error encountered while setting up a
|
43
|
+
# new connection.
|
44
|
+
#
|
45
|
+
# @since 2.10.0
|
46
|
+
CONNECTION_ERROR = :connection_error
|
47
|
+
|
38
48
|
# @return [ Mongo::Address ] address The address of the server the
|
39
49
|
# connection would have connected to.
|
40
50
|
#
|
@@ -50,7 +60,7 @@ module Mongo
|
|
50
60
|
# Create the event.
|
51
61
|
#
|
52
62
|
# @param [ Address ] address
|
53
|
-
# @param [ Symbol ]
|
63
|
+
# @param [ Symbol ] reason
|
54
64
|
#
|
55
65
|
# @since 2.9.0
|
56
66
|
# @api private
|
@@ -1,4 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# Copyright (C) 2019-2020 MongoDB Inc.
|
2
5
|
#
|
3
6
|
# Licensed under the Apache License, Version 2.0 (the 'License');
|
4
7
|
# you may not use this file except in compliance with the License.
|
@@ -1,4 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# Copyright (C) 2019-2020 MongoDB Inc.
|
2
5
|
#
|
3
6
|
# Licensed under the Apache License, Version 2.0 (the 'License');
|
4
7
|
# you may not use this file except in compliance with the License.
|
@@ -32,16 +35,24 @@ module Mongo
|
|
32
35
|
# @since 2.9.0
|
33
36
|
attr_reader :connection_id
|
34
37
|
|
38
|
+
# @return [ Mongo::Server::ConnectionPool ] pool The pool that the connection
|
39
|
+
# was checked in to.
|
40
|
+
#
|
41
|
+
# @since 2.11.0
|
42
|
+
# @api experimental
|
43
|
+
attr_reader :pool
|
44
|
+
|
35
45
|
# Create the event.
|
36
46
|
#
|
37
47
|
# @example Create the event.
|
38
|
-
# ConnectionCheckedIn.new(address, id)
|
48
|
+
# ConnectionCheckedIn.new(address, id, pool)
|
39
49
|
#
|
40
50
|
# @since 2.9.0
|
41
51
|
# @api private
|
42
|
-
def initialize(address, id)
|
52
|
+
def initialize(address, id, pool)
|
43
53
|
@address = address
|
44
54
|
@connection_id = id
|
55
|
+
@pool = pool
|
45
56
|
end
|
46
57
|
|
47
58
|
# Returns a concise yet useful summary of the event.
|
@@ -54,7 +65,7 @@ module Mongo
|
|
54
65
|
# @api experimental
|
55
66
|
def summary
|
56
67
|
"#<#{self.class.name.sub(/^Mongo::Monitoring::Event::Cmap::/, '')} " +
|
57
|
-
"address=#{address} connection_id=#{connection_id}>"
|
68
|
+
"address=#{address} connection_id=#{connection_id} pool=0x#{pool.object_id}>"
|
58
69
|
end
|
59
70
|
end
|
60
71
|
end
|