mongo 2.15.0 → 2.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.md +1 -1
- data/lib/mongo/bulk_write.rb +2 -2
- data/lib/mongo/client.rb +45 -5
- data/lib/mongo/cluster/periodic_executor.rb +4 -3
- data/lib/mongo/cluster/reapers/cursor_reaper.rb +76 -43
- data/lib/mongo/cluster/sdam_flow.rb +9 -3
- data/lib/mongo/cluster/topology/base.rb +13 -9
- data/lib/mongo/cluster/topology/load_balanced.rb +102 -0
- data/lib/mongo/cluster/topology.rb +28 -8
- data/lib/mongo/cluster.rb +136 -51
- data/lib/mongo/collection/view/aggregation.rb +5 -10
- data/lib/mongo/collection/view/builder/aggregation.rb +6 -5
- data/lib/mongo/collection/view/builder/map_reduce.rb +12 -49
- data/lib/mongo/collection/view/builder.rb +0 -4
- data/lib/mongo/collection/view/iterable.rb +58 -24
- data/lib/mongo/collection/view/map_reduce.rb +39 -15
- data/lib/mongo/collection/view/readable.rb +60 -51
- data/lib/mongo/collection/view/writable.rb +178 -175
- data/lib/mongo/collection/view.rb +15 -21
- data/lib/mongo/collection.rb +13 -13
- data/lib/mongo/cursor/kill_spec.rb +38 -0
- data/lib/mongo/cursor.rb +72 -31
- data/lib/mongo/database/view.rb +1 -1
- data/lib/mongo/error/bad_load_balancer_target.rb +26 -0
- data/lib/mongo/error/missing_service_id.rb +26 -0
- data/lib/mongo/error/no_service_connection_available.rb +49 -0
- data/lib/mongo/error/notable.rb +7 -0
- data/lib/mongo/error.rb +3 -0
- data/lib/mongo/grid/fs_bucket.rb +21 -2
- data/lib/mongo/id.rb +7 -5
- data/lib/mongo/index/view.rb +22 -41
- data/lib/mongo/monitoring/event/cmap/pool_cleared.rb +7 -4
- data/lib/mongo/monitoring/event/command_failed.rb +1 -1
- data/lib/mongo/monitoring/event/command_started.rb +2 -0
- data/lib/mongo/monitoring/publishable.rb +2 -2
- data/lib/mongo/operation/aggregate/command.rb +8 -0
- data/lib/mongo/operation/context.rb +19 -1
- data/lib/mongo/operation/count/command.rb +6 -0
- data/lib/mongo/operation/count/op_msg.rb +6 -0
- data/lib/mongo/operation/create/command.rb +7 -1
- data/lib/mongo/operation/create/op_msg.rb +7 -0
- data/lib/mongo/operation/create_index/command.rb +17 -1
- data/lib/mongo/operation/create_index/op_msg.rb +17 -4
- data/lib/mongo/operation/delete/command.rb +6 -3
- data/lib/mongo/operation/delete/legacy.rb +9 -2
- data/lib/mongo/operation/delete/op_msg.rb +8 -1
- data/lib/mongo/operation/distinct/command.rb +6 -0
- data/lib/mongo/operation/distinct/op_msg.rb +7 -0
- data/lib/mongo/operation/explain/command.rb +13 -1
- data/lib/mongo/operation/explain/legacy.rb +12 -5
- data/lib/mongo/operation/explain/op_msg.rb +9 -1
- data/lib/mongo/operation/find/builder/command.rb +110 -0
- data/lib/mongo/{collection/view → operation/find}/builder/flags.rb +10 -14
- data/lib/mongo/operation/find/builder/legacy.rb +123 -0
- data/lib/mongo/{collection/view → operation/find}/builder/modifiers.rb +31 -25
- data/lib/mongo/{cursor → operation/find}/builder.rb +4 -4
- data/lib/mongo/operation/find/command.rb +9 -0
- data/lib/mongo/operation/find/legacy.rb +10 -1
- data/lib/mongo/operation/find/op_msg.rb +12 -0
- data/lib/mongo/operation/find.rb +1 -0
- data/lib/mongo/operation/get_more/command.rb +1 -0
- data/lib/mongo/operation/get_more/command_builder.rb +38 -0
- data/lib/mongo/operation/get_more/op_msg.rb +1 -0
- data/lib/mongo/operation/get_more.rb +1 -0
- data/lib/mongo/operation/kill_cursors/command.rb +8 -0
- data/lib/mongo/operation/kill_cursors/command_builder.rb +35 -0
- data/lib/mongo/operation/kill_cursors/legacy.rb +2 -1
- data/lib/mongo/operation/kill_cursors/op_msg.rb +10 -0
- data/lib/mongo/operation/kill_cursors.rb +1 -0
- data/lib/mongo/operation/map_reduce/command.rb +8 -0
- data/lib/mongo/operation/map_reduce/op_msg.rb +1 -1
- data/lib/mongo/operation/shared/executable.rb +15 -1
- data/lib/mongo/operation/shared/polymorphic_operation.rb +1 -1
- data/lib/mongo/operation/shared/read_preference_supported.rb +3 -1
- data/lib/mongo/operation/shared/response_handling.rb +1 -0
- data/lib/mongo/operation/shared/sessions_supported.rb +12 -12
- data/lib/mongo/operation/shared/specifiable.rb +11 -29
- data/lib/mongo/operation/shared/validatable.rb +87 -0
- data/lib/mongo/operation/shared/write.rb +1 -1
- data/lib/mongo/operation/update/command.rb +6 -3
- data/lib/mongo/operation/update/legacy.rb +19 -11
- data/lib/mongo/operation/update/op_msg.rb +7 -4
- data/lib/mongo/operation/write_command/command.rb +51 -0
- data/lib/mongo/operation/write_command/op_msg.rb +43 -0
- data/lib/mongo/operation/write_command.rb +32 -0
- data/lib/mongo/operation.rb +10 -0
- data/lib/mongo/protocol/query.rb +35 -18
- data/lib/mongo/server/connection.rb +25 -3
- data/lib/mongo/server/connection_base.rb +12 -1
- data/lib/mongo/server/connection_common.rb +38 -1
- data/lib/mongo/server/connection_pool/generation_manager.rb +71 -0
- data/lib/mongo/server/connection_pool.rb +100 -27
- data/lib/mongo/server/description/features.rb +17 -16
- data/lib/mongo/server/description/load_balancer.rb +33 -0
- data/lib/mongo/server/description.rb +85 -6
- data/lib/mongo/server/monitor/connection.rb +5 -6
- data/lib/mongo/server/monitor.rb +2 -1
- data/lib/mongo/server/pending_connection.rb +47 -31
- data/lib/mongo/server/push_monitor.rb +10 -1
- data/lib/mongo/server.rb +73 -26
- data/lib/mongo/server_selector/base.rb +5 -1
- data/lib/mongo/session/session_pool.rb +11 -0
- data/lib/mongo/session.rb +21 -1
- data/lib/mongo/socket/ocsp_verifier.rb +6 -37
- data/lib/mongo/uri/options_mapper.rb +1 -0
- data/lib/mongo/uri/srv_protocol.rb +6 -8
- data/lib/mongo/uri.rb +18 -0
- data/lib/mongo/utils.rb +0 -7
- data/lib/mongo/version.rb +1 -1
- data/mongo.gemspec +1 -1
- data/spec/integration/auth_spec.rb +31 -1
- data/spec/integration/awaited_ismaster_spec.rb +1 -1
- data/spec/integration/bulk_write_spec.rb +1 -1
- data/spec/integration/change_stream_spec.rb +3 -3
- data/spec/integration/client_construction_spec.rb +54 -0
- data/spec/integration/client_side_encryption/auto_encryption_bulk_writes_spec.rb +1 -1
- data/spec/integration/client_side_encryption/auto_encryption_command_monitoring_spec.rb +1 -1
- data/spec/integration/client_side_encryption/bson_size_limit_spec.rb +1 -1
- data/spec/integration/client_side_encryption/data_key_spec.rb +1 -1
- data/spec/integration/client_spec.rb +2 -0
- data/spec/integration/command_monitoring_spec.rb +1 -1
- data/spec/integration/command_spec.rb +1 -1
- data/spec/integration/connection_spec.rb +52 -35
- data/spec/integration/crud_spec.rb +174 -1
- data/spec/integration/cursor_pinning_spec.rb +121 -0
- data/spec/integration/cursor_reaping_spec.rb +8 -4
- data/spec/integration/fork_reconnect_spec.rb +1 -5
- data/spec/integration/get_more_spec.rb +1 -1
- data/spec/integration/heartbeat_events_spec.rb +1 -1
- data/spec/integration/map_reduce_spec.rb +77 -0
- data/spec/integration/query_cache_spec.rb +47 -2
- data/spec/integration/query_cache_transactions_spec.rb +1 -1
- data/spec/integration/read_concern_spec.rb +1 -1
- data/spec/integration/read_preference_spec.rb +1 -1
- data/spec/integration/reconnect_spec.rb +30 -12
- data/spec/integration/retryable_errors_spec.rb +1 -1
- data/spec/integration/retryable_writes/retryable_writes_36_and_older_spec.rb +1 -1
- data/spec/integration/retryable_writes/retryable_writes_40_and_newer_spec.rb +1 -1
- data/spec/integration/sdam_error_handling_spec.rb +5 -3
- data/spec/integration/sdam_events_spec.rb +35 -19
- data/spec/integration/sdam_prose_spec.rb +1 -1
- data/spec/integration/server_monitor_spec.rb +1 -0
- data/spec/integration/server_selector_spec.rb +22 -5
- data/spec/integration/server_spec.rb +2 -0
- data/spec/integration/srv_monitoring_spec.rb +1 -1
- data/spec/integration/step_down_spec.rb +1 -1
- data/spec/integration/transaction_pinning_spec.rb +120 -0
- data/spec/integration/versioned_api_examples_spec.rb +45 -0
- data/spec/integration/x509_auth_spec.rb +1 -1
- data/spec/lite_spec_helper.rb +1 -2
- data/spec/mongo/address/unix_spec.rb +1 -0
- data/spec/mongo/auth/cr_spec.rb +2 -3
- data/spec/mongo/auth/ldap_spec.rb +2 -3
- data/spec/mongo/auth/scram_spec.rb +2 -3
- data/spec/mongo/auth/user/view_spec.rb +1 -1
- data/spec/mongo/auth/x509_spec.rb +2 -3
- data/spec/mongo/bulk_write_spec.rb +3 -3
- data/spec/mongo/client_construction_spec.rb +259 -28
- data/spec/mongo/client_spec.rb +6 -4
- data/spec/mongo/cluster/cursor_reaper_spec.rb +36 -21
- data/spec/mongo/cluster/periodic_executor_spec.rb +3 -1
- data/spec/mongo/cluster_spec.rb +44 -3
- data/spec/mongo/collection/view/aggregation_spec.rb +1 -1
- data/spec/mongo/collection/view/builder/find_command_spec.rb +4 -0
- data/spec/mongo/collection/view/builder/op_query_spec.rb +4 -0
- data/spec/mongo/collection/view/map_reduce_spec.rb +1 -1
- data/spec/mongo/collection_crud_spec.rb +7 -2
- data/spec/mongo/collection_ddl_spec.rb +1 -1
- data/spec/mongo/collection_spec.rb +1 -1
- data/spec/mongo/cursor/builder/get_more_command_spec.rb +4 -0
- data/spec/mongo/cursor/builder/op_get_more_spec.rb +4 -0
- data/spec/mongo/cursor_spec.rb +15 -5
- data/spec/mongo/database_spec.rb +15 -15
- data/spec/mongo/error/operation_failure_heavy_spec.rb +1 -1
- data/spec/mongo/grid/fs_bucket_spec.rb +18 -12
- data/spec/mongo/grid/stream/write_spec.rb +3 -9
- data/spec/mongo/grid/stream_spec.rb +1 -1
- data/spec/mongo/index/view_spec.rb +2 -2
- data/spec/mongo/operation/delete/op_msg_spec.rb +1 -1
- data/spec/mongo/{collection/view → operation/find}/builder/flags_spec.rb +2 -2
- data/spec/mongo/{collection/view → operation/find}/builder/modifiers_spec.rb +2 -2
- data/spec/mongo/operation/find/legacy_spec.rb +1 -0
- data/spec/mongo/operation/insert/bulk_spec.rb +1 -1
- data/spec/mongo/operation/insert/op_msg_spec.rb +1 -1
- data/spec/mongo/operation/kill_cursors_spec.rb +4 -1
- data/spec/mongo/operation/read_preference_legacy_spec.rb +4 -0
- data/spec/mongo/operation/read_preference_op_msg_spec.rb +2 -0
- data/spec/mongo/operation/update/bulk_spec.rb +1 -1
- data/spec/mongo/operation/update/op_msg_spec.rb +1 -1
- data/spec/mongo/query_cache_spec.rb +6 -2
- data/spec/mongo/server/connection_common_spec.rb +62 -11
- data/spec/mongo/server/connection_pool_spec.rb +73 -7
- data/spec/mongo/server/connection_spec.rb +138 -43
- data/spec/mongo/server/description_spec.rb +1 -1
- data/spec/mongo/server/monitor/connection_spec.rb +22 -0
- data/spec/mongo/server/monitor_spec.rb +4 -3
- data/spec/mongo/server/push_monitor_spec.rb +101 -0
- data/spec/mongo/session/session_pool_spec.rb +42 -10
- data/spec/mongo/session_transaction_spec.rb +15 -30
- data/spec/mongo/socket/unix_spec.rb +1 -0
- data/spec/mongo/uri_option_parsing_spec.rb +38 -5
- data/spec/runners/change_streams/test.rb +1 -1
- data/spec/runners/cmap.rb +1 -1
- data/spec/runners/connection_string.rb +7 -3
- data/spec/runners/crud/operation.rb +5 -3
- data/spec/runners/crud/requirement.rb +1 -0
- data/spec/runners/crud.rb +1 -1
- data/spec/runners/sdam.rb +2 -1
- data/spec/runners/transactions/test.rb +2 -2
- data/spec/runners/unified/assertions.rb +2 -3
- data/spec/runners/unified/event_subscriber.rb +2 -2
- data/spec/runners/unified/support_operations.rb +10 -2
- data/spec/runners/unified/test.rb +3 -0
- data/spec/runners/unified.rb +1 -1
- data/spec/shared/lib/mrss/cluster_config.rb +6 -1
- data/spec/shared/lib/mrss/constraints.rb +11 -5
- data/spec/shared/lib/mrss/event_subscriber.rb +200 -0
- data/spec/shared/lib/mrss/server_version_registry.rb +17 -12
- data/spec/shared/share/Dockerfile.erb +5 -4
- data/spec/shared/shlib/server.sh +70 -20
- data/spec/spec_tests/change_streams_spec.rb +1 -1
- data/spec/spec_tests/cmap_spec.rb +4 -1
- data/spec/spec_tests/command_monitoring_spec.rb +2 -2
- data/spec/spec_tests/data/command_monitoring/find.yml +9 -9
- data/spec/spec_tests/data/crud/read/aggregate-collation.yml +2 -1
- data/spec/spec_tests/data/crud/read/aggregate-out.yml +1 -0
- data/spec/spec_tests/data/crud/read/count-collation.yml +2 -1
- data/spec/spec_tests/data/crud/read/distinct-collation.yml +2 -1
- data/spec/spec_tests/data/crud/read/find-collation.yml +2 -1
- data/spec/spec_tests/data/crud/write/bulkWrite-collation.yml +2 -1
- data/spec/spec_tests/data/crud/write/deleteMany-collation.yml +2 -1
- data/spec/spec_tests/data/crud/write/deleteOne-collation.yml +2 -1
- data/spec/spec_tests/data/crud/write/findOneAndDelete-collation.yml +3 -2
- data/spec/spec_tests/data/crud/write/findOneAndReplace-collation.yml +2 -1
- data/spec/spec_tests/data/crud/write/findOneAndUpdate-collation.yml +3 -2
- data/spec/spec_tests/data/crud/write/replaceOne-collation.yml +3 -2
- data/spec/spec_tests/data/crud/write/updateMany-collation.yml +2 -1
- data/spec/spec_tests/data/crud/write/updateOne-collation.yml +2 -1
- data/spec/spec_tests/data/load_balancers/event-monitoring.yml +99 -0
- data/spec/spec_tests/data/load_balancers/lb-connection-establishment.yml +36 -0
- data/spec/spec_tests/data/load_balancers/non-lb-connection-establishment.yml +56 -0
- data/spec/spec_tests/data/load_balancers/server-selection.yml +50 -0
- data/spec/spec_tests/data/retryable_reads/changeStreams-client.watch-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/changeStreams-client.watch.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.watch-serverErrors.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.watch.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/mapReduce.yml +3 -1
- data/spec/spec_tests/data/sdam/load-balanced/discover_load_balancer.yml +25 -0
- data/spec/spec_tests/data/sdam_integration/find-network-error.yml +2 -0
- data/spec/spec_tests/data/sdam_integration/find-shutdown-error.yml +2 -0
- data/spec/spec_tests/data/sdam_integration/hello-command-error.yml +3 -1
- data/spec/spec_tests/data/sdam_integration/hello-network-error.yml +3 -1
- data/spec/spec_tests/data/sdam_integration/hello-timeout.yml +2 -0
- data/spec/spec_tests/data/sdam_integration/insert-network-error.yml +2 -0
- data/spec/spec_tests/data/sdam_integration/insert-shutdown-error.yml +2 -0
- data/spec/spec_tests/data/sdam_monitoring/load_balancer.yml +65 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-directConnection.yml +13 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-replicaSet-errors.yml +6 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-true-multiple-hosts.yml +5 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-true-txt.yml +10 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/direct-connection-false.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/direct-connection-true.yml +0 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/encoded-userinfo-and-db.yml +15 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/loadBalanced-false-txt.yml +10 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/longer-parent-in-return.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/misformatted-option.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/no-results.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/not-enough-parts.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/one-result-default-port.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/one-txt-record-multiple-strings.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/one-txt-record.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/parent-part-mismatch1.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/parent-part-mismatch2.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/parent-part-mismatch3.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/parent-part-mismatch4.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/parent-part-mismatch5.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/returned-parent-too-short.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/returned-parent-wrong.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/two-results-default-port.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/two-results-nonstandard-port.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/two-txt-records.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/txt-record-not-allowed-option.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/txt-record-with-overridden-ssl-option.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/txt-record-with-overridden-uri-option.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/txt-record-with-unallowed-option.yml +0 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/uri-with-admin-database.yml +13 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/uri-with-auth.yml +12 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/uri-with-port.yml +0 -0
- data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/uri-with-two-hosts.yml +0 -0
- data/spec/spec_tests/data/transactions/retryable-abort-errorLabels.yml +2 -0
- data/spec/spec_tests/data/transactions/retryable-abort.yml +2 -0
- data/spec/spec_tests/data/transactions/retryable-commit-errorLabels.yml +2 -0
- data/spec/spec_tests/data/transactions/retryable-commit.yml +2 -0
- data/spec/spec_tests/data/transactions/retryable-writes.yml +2 -0
- data/spec/spec_tests/data/uri_options/connection-options.yml +60 -0
- data/spec/spec_tests/load_balancers_spec.rb +15 -0
- data/spec/spec_tests/retryable_reads_spec.rb +2 -2
- data/spec/spec_tests/retryable_writes_spec.rb +1 -1
- data/spec/spec_tests/sdam_integration_spec.rb +1 -1
- data/spec/spec_tests/sdam_monitoring_spec.rb +10 -5
- data/spec/spec_tests/sdam_spec.rb +1 -1
- data/spec/spec_tests/seed_list_discovery_spec.rb +118 -0
- data/spec/spec_tests/uri_options_spec.rb +4 -4
- data/spec/stress/fork_reconnect_stress_spec.rb +1 -5
- data/spec/stress/push_monitor_close_spec.rb +44 -0
- data/spec/support/certificates/atlas-ocsp-ca.crt +82 -90
- data/spec/support/certificates/atlas-ocsp.crt +127 -122
- data/spec/support/common_shortcuts.rb +2 -3
- data/spec/support/matchers.rb +13 -0
- data/spec/support/shared/auth_context.rb +16 -0
- data/spec/support/shared/session.rb +2 -2
- data/spec/support/spec_config.rb +10 -11
- data/spec/support/using_hash.rb +31 -0
- data/spec/support/utils.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +1077 -1029
- metadata.gz.sig +0 -0
- data/lib/mongo/collection/view/builder/find_command.rb +0 -173
- data/lib/mongo/collection/view/builder/op_query.rb +0 -94
- data/lib/mongo/cursor/builder/get_more_command.rb +0 -80
- data/lib/mongo/cursor/builder/kill_cursors_command.rb +0 -111
- data/lib/mongo/cursor/builder/op_get_more.rb +0 -64
- data/lib/mongo/cursor/builder/op_kill_cursors.rb +0 -106
- data/lib/mongo/server/context.rb +0 -72
- data/spec/mongo/cursor/builder/op_kill_cursors_spec.rb +0 -66
- data/spec/runners/unified/using_hash.rb +0 -34
- data/spec/spec_tests/dns_seedlist_discovery_spec.rb +0 -79
- data/spec/support/event_subscriber.rb +0 -221
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require 'spec_helper'
|
5
|
+
|
6
|
+
describe 'Map-reduce operations' do
|
7
|
+
let(:client) { authorized_client }
|
8
|
+
let(:collection) { client['mr_integration'] }
|
9
|
+
|
10
|
+
let(:subscriber) { Mrss::EventSubscriber.new }
|
11
|
+
|
12
|
+
let(:find_options) { {} }
|
13
|
+
|
14
|
+
let(:operation) do
|
15
|
+
collection.find({}, find_options).map_reduce('function(){}', 'function(){}')
|
16
|
+
end
|
17
|
+
|
18
|
+
before do
|
19
|
+
collection.insert_one(test: 1)
|
20
|
+
client.subscribe(Mongo::Monitoring::COMMAND, subscriber)
|
21
|
+
end
|
22
|
+
|
23
|
+
let(:event) { subscriber.single_command_started_event('mapReduce') }
|
24
|
+
|
25
|
+
context 'read preference' do
|
26
|
+
require_topology :sharded
|
27
|
+
|
28
|
+
context 'specified on client' do
|
29
|
+
let(:client) { authorized_client.with(read: {mode: :secondary_preferred }) }
|
30
|
+
|
31
|
+
# RUBY-2706: read preference is not sent on pre-3.6 servers
|
32
|
+
min_server_fcv '3.6'
|
33
|
+
|
34
|
+
it 'is sent' do
|
35
|
+
operation.to_a
|
36
|
+
|
37
|
+
event.command['$readPreference'].should == {'mode' => 'secondaryPreferred'}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'specified on collection' do
|
42
|
+
let(:collection) { client['mr_integration', read: {mode: :secondary_preferred }] }
|
43
|
+
|
44
|
+
# RUBY-2706: read preference is not sent on pre-3.6 servers
|
45
|
+
min_server_fcv '3.6'
|
46
|
+
|
47
|
+
it 'is sent' do
|
48
|
+
operation.to_a
|
49
|
+
|
50
|
+
event.command['$readPreference'].should == {'mode' => 'secondaryPreferred'}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'specified on operation' do
|
55
|
+
let(:find_options) { {read: {mode: :secondary_preferred }} }
|
56
|
+
|
57
|
+
# RUBY-2706: read preference is not sent on pre-3.6 servers
|
58
|
+
min_server_fcv '3.6'
|
59
|
+
|
60
|
+
it 'is sent' do
|
61
|
+
operation.to_a
|
62
|
+
|
63
|
+
event.command['$readPreference'].should == {'mode' => 'secondaryPreferred'}
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context 'session' do
|
69
|
+
min_server_fcv '3.6'
|
70
|
+
|
71
|
+
it 'is sent' do
|
72
|
+
operation.to_a
|
73
|
+
|
74
|
+
event.command['lsid'].should_not be nil
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -28,7 +28,7 @@ describe 'QueryCache' do
|
|
28
28
|
SessionRegistry.instance.verify_sessions_ended!
|
29
29
|
end
|
30
30
|
|
31
|
-
let(:subscriber) { EventSubscriber.new }
|
31
|
+
let(:subscriber) { Mrss::EventSubscriber.new }
|
32
32
|
|
33
33
|
let(:client) do
|
34
34
|
authorized_client.tap do |client|
|
@@ -969,7 +969,7 @@ describe 'QueryCache' do
|
|
969
969
|
|
970
970
|
context 'when find command fails and retries' do
|
971
971
|
require_fail_command
|
972
|
-
|
972
|
+
require_no_multi_mongos
|
973
973
|
require_warning_clean
|
974
974
|
|
975
975
|
before do
|
@@ -1045,4 +1045,49 @@ describe 'QueryCache' do
|
|
1045
1045
|
expect(events.length).to eq(2)
|
1046
1046
|
end
|
1047
1047
|
end
|
1048
|
+
|
1049
|
+
context 'when result set has multiple documents and cursor is iterated partially' do
|
1050
|
+
|
1051
|
+
before do
|
1052
|
+
Mongo::QueryCache.enabled = false
|
1053
|
+
5.times do
|
1054
|
+
authorized_collection.insert_one({ name: 'testing' })
|
1055
|
+
end
|
1056
|
+
end
|
1057
|
+
|
1058
|
+
shared_examples 'retrieves full result set on second iteration' do
|
1059
|
+
it 'retrieves full result set on second iteration' do
|
1060
|
+
Mongo::QueryCache.clear
|
1061
|
+
Mongo::QueryCache.enabled = true
|
1062
|
+
|
1063
|
+
partial_first_iteration
|
1064
|
+
|
1065
|
+
authorized_collection.find.to_a.length.should == 5
|
1066
|
+
end
|
1067
|
+
|
1068
|
+
end
|
1069
|
+
|
1070
|
+
context 'using each & break' do
|
1071
|
+
let(:partial_first_iteration) do
|
1072
|
+
called = false
|
1073
|
+
authorized_collection.find.each do
|
1074
|
+
called = true
|
1075
|
+
break
|
1076
|
+
end
|
1077
|
+
called.should be true
|
1078
|
+
end
|
1079
|
+
|
1080
|
+
include_examples 'retrieves full result set on second iteration'
|
1081
|
+
end
|
1082
|
+
|
1083
|
+
context 'using next' do
|
1084
|
+
let(:partial_first_iteration) do
|
1085
|
+
# #next is executed in its own fiber, and query cache is disabled
|
1086
|
+
# for that operation.
|
1087
|
+
authorized_collection.find.to_enum.next
|
1088
|
+
end
|
1089
|
+
|
1090
|
+
include_examples 'retrieves full result set on second iteration'
|
1091
|
+
end
|
1092
|
+
end
|
1048
1093
|
end
|
@@ -23,7 +23,7 @@ describe 'QueryCache with transactions' do
|
|
23
23
|
# leak sessions independently of the query cache. This will be resolved by
|
24
24
|
# RUBY-2391.
|
25
25
|
|
26
|
-
let(:subscriber) { EventSubscriber.new }
|
26
|
+
let(:subscriber) { Mrss::EventSubscriber.new }
|
27
27
|
|
28
28
|
let(:client) do
|
29
29
|
authorized_client.tap do |client|
|
@@ -16,20 +16,38 @@ describe 'Client after reconnect' do
|
|
16
16
|
expect(doc['testk']).to eq('testv')
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
expect(thread).to be_alive
|
19
|
+
context 'non-lb' do
|
20
|
+
require_topology :single, :replica_set, :sharded
|
22
21
|
|
23
|
-
thread
|
24
|
-
|
25
|
-
|
26
|
-
expect(thread).not_to be_alive
|
22
|
+
it 'recreates monitor thread' do
|
23
|
+
thread = client.cluster.servers.first.monitor.instance_variable_get('@thread')
|
24
|
+
expect(thread).to be_alive
|
27
25
|
|
28
|
-
|
26
|
+
thread.kill
|
27
|
+
# context switch to let the thread get killed
|
28
|
+
sleep 0.1
|
29
|
+
expect(thread).not_to be_alive
|
30
|
+
|
31
|
+
client.reconnect
|
32
|
+
|
33
|
+
new_thread = client.cluster.servers.first.monitor.instance_variable_get('@thread')
|
34
|
+
expect(new_thread).not_to eq(thread)
|
35
|
+
expect(new_thread).to be_alive
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'lb' do
|
40
|
+
require_topology :load_balanced
|
29
41
|
|
30
|
-
|
31
|
-
|
32
|
-
|
42
|
+
it 'does not recreate monitor thread' do
|
43
|
+
thread = client.cluster.servers.first.monitor.instance_variable_get('@thread')
|
44
|
+
expect(thread).to be nil
|
45
|
+
|
46
|
+
client.reconnect
|
47
|
+
|
48
|
+
new_thread = client.cluster.servers.first.monitor.instance_variable_get('@thread')
|
49
|
+
expect(new_thread).to be nil
|
50
|
+
end
|
33
51
|
end
|
34
52
|
|
35
53
|
context 'with min_pool_size > 0' do
|
@@ -114,7 +132,7 @@ describe 'Client after reconnect' do
|
|
114
132
|
context 'in sharded topology' do
|
115
133
|
require_topology :sharded
|
116
134
|
require_default_port_deployment
|
117
|
-
|
135
|
+
require_multi_mongos
|
118
136
|
|
119
137
|
let(:expected_topology_cls) { Mongo::Cluster::Topology::Sharded }
|
120
138
|
|
@@ -20,7 +20,7 @@ describe 'Retryable writes integration tests' do
|
|
20
20
|
|
21
21
|
# These tests override server selector, which fails if there are multiple
|
22
22
|
# eligible servers as would be the case in a multi-shard sharded cluster
|
23
|
-
|
23
|
+
require_no_multi_mongos
|
24
24
|
|
25
25
|
# Note: these tests are deprecated in favor of the tests in the file
|
26
26
|
# spec/integration/retryable_writes/retryable_writes_40_and_newer_spec.rb
|
@@ -4,6 +4,8 @@
|
|
4
4
|
require 'spec_helper'
|
5
5
|
|
6
6
|
describe 'SDAM error handling' do
|
7
|
+
require_topology :single, :replica_set, :sharded
|
8
|
+
|
7
9
|
clean_slate
|
8
10
|
|
9
11
|
after do
|
@@ -14,9 +16,9 @@ describe 'SDAM error handling' do
|
|
14
16
|
|
15
17
|
# These tests operate on specific servers, and don't work in a multi
|
16
18
|
# shard cluster where multiple servers are equally eligible
|
17
|
-
|
19
|
+
require_no_multi_mongos
|
18
20
|
|
19
|
-
let(:diagnostic_subscriber) { VerboseEventSubscriber.new }
|
21
|
+
let(:diagnostic_subscriber) { Mrss::VerboseEventSubscriber.new }
|
20
22
|
|
21
23
|
let(:client) do
|
22
24
|
new_local_client(SpecConfig.instance.addresses,
|
@@ -288,7 +290,7 @@ describe 'SDAM error handling' do
|
|
288
290
|
describe 'when there is an error on monitoring connection' do
|
289
291
|
clean_slate_for_all
|
290
292
|
|
291
|
-
let(:subscriber) { EventSubscriber.new }
|
293
|
+
let(:subscriber) { Mrss::EventSubscriber.new }
|
292
294
|
|
293
295
|
let(:set_subscribers) do
|
294
296
|
client.subscribe(Mongo::Monitoring::SERVER_DESCRIPTION_CHANGED, subscriber)
|
@@ -4,7 +4,7 @@
|
|
4
4
|
require 'spec_helper'
|
5
5
|
|
6
6
|
describe 'SDAM events' do
|
7
|
-
let(:subscriber) { EventSubscriber.new }
|
7
|
+
let(:subscriber) { Mrss::EventSubscriber.new }
|
8
8
|
|
9
9
|
describe 'server closed event' do
|
10
10
|
it 'is published when client is closed' do
|
@@ -50,13 +50,20 @@ describe 'SDAM events' do
|
|
50
50
|
context 'pre-4.4 servers' do
|
51
51
|
max_server_version '4.2'
|
52
52
|
|
53
|
+
let(:sdam_proc) do
|
54
|
+
Proc.new do |client|
|
55
|
+
client.subscribe(Mongo::Monitoring::SERVER_HEARTBEAT, subscriber)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
53
59
|
let(:client) do
|
54
60
|
new_local_client(SpecConfig.instance.addresses,
|
55
61
|
# Heartbeat interval is bound by 500 ms
|
56
|
-
SpecConfig.instance.test_options.merge(
|
57
|
-
|
58
|
-
|
59
|
-
|
62
|
+
SpecConfig.instance.test_options.merge(
|
63
|
+
heartbeat_frequency: 0.5,
|
64
|
+
sdam_proc: sdam_proc
|
65
|
+
),
|
66
|
+
)
|
60
67
|
end
|
61
68
|
|
62
69
|
it 'is published every heartbeat interval' do
|
@@ -78,13 +85,20 @@ describe 'SDAM events' do
|
|
78
85
|
context '4.4+ servers' do
|
79
86
|
min_server_fcv '4.4'
|
80
87
|
|
88
|
+
let(:sdam_proc) do
|
89
|
+
Proc.new do |client|
|
90
|
+
client.subscribe(Mongo::Monitoring::SERVER_HEARTBEAT, subscriber)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
81
94
|
let(:client) do
|
82
95
|
new_local_client(SpecConfig.instance.addresses,
|
83
96
|
# Heartbeat interval is bound by 500 ms
|
84
|
-
SpecConfig.instance.test_options.merge(
|
85
|
-
|
86
|
-
|
87
|
-
|
97
|
+
SpecConfig.instance.test_options.merge(
|
98
|
+
heartbeat_frequency: 0.5,
|
99
|
+
sdam_proc: sdam_proc
|
100
|
+
),
|
101
|
+
)
|
88
102
|
end
|
89
103
|
|
90
104
|
it 'is published up to twice every heartbeat interval' do
|
@@ -92,23 +106,25 @@ describe 'SDAM events' do
|
|
92
106
|
sleep 3
|
93
107
|
client.close
|
94
108
|
|
95
|
-
|
109
|
+
started_events = subscriber.select_started_events(
|
110
|
+
Mongo::Monitoring::Event::ServerHeartbeatStarted
|
111
|
+
)
|
96
112
|
# We could have up to 16 events and should have no fewer than 8 events.
|
97
113
|
# Whenever an awaited hello succeeds while the regular monitor is
|
98
114
|
# waiting, the regular monitor's next scan is pushed forward.
|
99
|
-
|
100
|
-
|
101
|
-
(started_awaited =
|
102
|
-
(started_regular =
|
115
|
+
started_events.length.should >= 6
|
116
|
+
started_events.length.should <= 18
|
117
|
+
(started_awaited = started_events.select(&:awaited?)).should_not be_empty
|
118
|
+
(started_regular = started_events.reject(&:awaited?)).should_not be_empty
|
103
119
|
|
104
|
-
|
120
|
+
completed_events = subscriber.select_completed_events(
|
105
121
|
Mongo::Monitoring::Event::ServerHeartbeatSucceeded,
|
106
122
|
Mongo::Monitoring::Event::ServerHeartbeatFailed,
|
107
123
|
)
|
108
|
-
|
109
|
-
|
110
|
-
(succeeded_awaited =
|
111
|
-
(succeeded_regular =
|
124
|
+
completed_events.length.should >= 6
|
125
|
+
completed_events.length.should <= 18
|
126
|
+
(succeeded_awaited = completed_events.select(&:awaited?)).should_not be_empty
|
127
|
+
(succeeded_regular = completed_events.reject(&:awaited?)).should_not be_empty
|
112
128
|
|
113
129
|
# There may be in-flight hellos that don't complete, both
|
114
130
|
# regular and awaited.
|
@@ -11,7 +11,7 @@ describe 'Server selector' do
|
|
11
11
|
describe '#select_server' do
|
12
12
|
# These tests operate on specific servers, and don't work in a multi
|
13
13
|
# shard cluster where multiple servers are equally eligible
|
14
|
-
|
14
|
+
require_no_multi_mongos
|
15
15
|
|
16
16
|
let(:result) { selector.select_server(cluster) }
|
17
17
|
|
@@ -52,6 +52,8 @@ describe 'Server selector' do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
context 'there is no known primary' do
|
55
|
+
require_topology :single, :replica_set, :sharded
|
56
|
+
|
55
57
|
before do
|
56
58
|
primary_server = client.cluster.next_primary
|
57
59
|
client.close
|
@@ -59,15 +61,30 @@ describe 'Server selector' do
|
|
59
61
|
primary_server.unknown!
|
60
62
|
end
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
64
|
+
context 'non-lb' do
|
65
|
+
require_topology :single, :replica_set, :sharded
|
66
|
+
|
67
|
+
it 'raises NoServerAvailable with a message explaining the situation' do
|
68
|
+
expect do
|
69
|
+
result
|
70
|
+
end.to raise_error(Mongo::Error::NoServerAvailable, /The cluster is disconnected \(client may have been closed\)/)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'lb' do
|
75
|
+
require_topology :load_balanced
|
76
|
+
|
77
|
+
it 'returns the load balancer' do
|
78
|
+
expect(result).to be_a(Mongo::Server)
|
79
|
+
result.should be_load_balancer
|
80
|
+
end
|
66
81
|
end
|
67
82
|
end
|
68
83
|
end
|
69
84
|
|
70
85
|
context 'monitoring thread is dead' do
|
86
|
+
require_topology :single, :replica_set, :sharded
|
87
|
+
|
71
88
|
before do
|
72
89
|
client.cluster.servers.each do |server|
|
73
90
|
server.monitor.instance_variable_get('@thread').kill
|
@@ -32,7 +32,7 @@ describe 'Step down behavior' do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
let(:subscriber) { EventSubscriber.new }
|
35
|
+
let(:subscriber) { Mrss::EventSubscriber.new }
|
36
36
|
|
37
37
|
let(:test_client) do
|
38
38
|
authorized_client_without_any_retries.with(server_selection_timeout: 20).tap do |client|
|
@@ -0,0 +1,120 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require 'spec_helper'
|
5
|
+
|
6
|
+
describe 'Transaction pinning' do
|
7
|
+
let(:client) { authorized_client.with(max_pool_size: 4) }
|
8
|
+
let(:collection_name) { 'tx_pinning' }
|
9
|
+
let(:collection) { client[collection_name] }
|
10
|
+
|
11
|
+
before do
|
12
|
+
authorized_client[collection_name].insert_many([{test: 1}] * 200)
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:server) { client.cluster.next_primary }
|
16
|
+
|
17
|
+
clean_slate
|
18
|
+
|
19
|
+
context 'non-lb' do
|
20
|
+
require_topology :sharded
|
21
|
+
min_server_fcv '4.2'
|
22
|
+
|
23
|
+
# Start several transactions, then complete each of them.
|
24
|
+
# Force each transaction to be on its own connection.
|
25
|
+
|
26
|
+
before do
|
27
|
+
4.times do |i|
|
28
|
+
# Collections cannot be created inside transactions.
|
29
|
+
client["tx_pin_t#{i}"].drop
|
30
|
+
client["tx_pin_t#{i}"].create
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'works' do
|
35
|
+
sessions = []
|
36
|
+
connections = []
|
37
|
+
|
38
|
+
4.times do |i|
|
39
|
+
session = client.start_session
|
40
|
+
session.start_transaction
|
41
|
+
client["tx_pin_t#{i}"].insert_one({test: 1}, session: session)
|
42
|
+
session.pinned_server.should be_a(Mongo::Server)
|
43
|
+
sessions << session
|
44
|
+
connections << server.pool.check_out
|
45
|
+
end
|
46
|
+
|
47
|
+
server.pool.size.should == 4
|
48
|
+
|
49
|
+
connections.each do |c|
|
50
|
+
server.pool.check_in(c)
|
51
|
+
end
|
52
|
+
|
53
|
+
sessions.each_with_index do |session, i|
|
54
|
+
client["tx_pin_t#{i}"].insert_one({test: 2}, session: session)
|
55
|
+
session.commit_transaction
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context 'lb' do
|
61
|
+
require_topology :load_balanced
|
62
|
+
min_server_fcv '4.2'
|
63
|
+
|
64
|
+
# In load-balanced topology, we cannot create new connections to a
|
65
|
+
# particular service.
|
66
|
+
|
67
|
+
context 'when no connection is available' do
|
68
|
+
|
69
|
+
before do
|
70
|
+
client["tx_pin"].drop
|
71
|
+
client["tx_pin"].create
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'raises ConnectionCheckOutTimeout' do
|
75
|
+
session = client.start_session
|
76
|
+
session.start_transaction
|
77
|
+
client["tx_pin"].insert_one({test: 1}, session: session)
|
78
|
+
session.pinned_server.should be nil
|
79
|
+
session.pinned_service_id.should_not be nil
|
80
|
+
|
81
|
+
server.pool.size.should == 1
|
82
|
+
server.pool.clear
|
83
|
+
server.pool.size.should == 0
|
84
|
+
|
85
|
+
lambda do
|
86
|
+
client["tx_pin"].insert_one({test: 2}, session: session)
|
87
|
+
end.should raise_error(Mongo::Error::ConnectionCheckOutTimeout)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
context 'when connection is available' do
|
92
|
+
|
93
|
+
it 'uses the available connection' do
|
94
|
+
sessions = []
|
95
|
+
connections = []
|
96
|
+
|
97
|
+
4.times do |i|
|
98
|
+
session = client.start_session
|
99
|
+
session.start_transaction
|
100
|
+
client["tx_pin_t#{i}"].insert_one({test: 1}, session: session)
|
101
|
+
session.pinned_server.should be nil
|
102
|
+
session.pinned_service_id.should_not be nil
|
103
|
+
sessions << session
|
104
|
+
connections << server.pool.check_out
|
105
|
+
end
|
106
|
+
|
107
|
+
server.pool.size.should == 4
|
108
|
+
|
109
|
+
connections.each do |c|
|
110
|
+
server.pool.check_in(c)
|
111
|
+
end
|
112
|
+
|
113
|
+
sessions.each_with_index do |session, i|
|
114
|
+
client["tx_pin_t#{i}"].insert_one({test: 2}, session: session)
|
115
|
+
session.commit_transaction
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -66,4 +66,49 @@ describe 'Versioned API examples' do
|
|
66
66
|
# Do not leak clients.
|
67
67
|
client.close
|
68
68
|
end
|
69
|
+
|
70
|
+
it "Versioned API Strict Migration Example" do
|
71
|
+
client = Mongo::Client.new(uri_string, server_api: {version: "1", strict: true})
|
72
|
+
client[:sales].drop
|
73
|
+
|
74
|
+
# Start Versioned API Example 5
|
75
|
+
|
76
|
+
client[:sales].insert_many([
|
77
|
+
{ _id: 1, item: "abc", price: 10, quantity: 2, date: DateTime.parse("2021-01-01T08:00:00Z") },
|
78
|
+
{ _id: 2, item: "jkl", price: 20, quantity: 1, date: DateTime.parse("2021-02-03T09:00:00Z") },
|
79
|
+
{ _id: 3, item: "xyz", price: 5, quantity: 5, date: DateTime.parse("2021-02-03T09:05:00Z") },
|
80
|
+
{ _id: 4, item: "abc", price: 10, quantity: 10, date: DateTime.parse("2021-02-15T08:00:00Z") },
|
81
|
+
{ _id: 5, item: "xyz", price: 5, quantity: 10, date: DateTime.parse("2021-02-15T09:05:00Z") },
|
82
|
+
{ _id: 6, item: "xyz", price: 5, quantity: 5, date: DateTime.parse("2021-02-15T12:05:10Z") },
|
83
|
+
{ _id: 7, item: "xyz", price: 5, quantity: 10, date: DateTime.parse("2021-02-15T14:12:12Z") },
|
84
|
+
{ _id: 8, item: "abc", price: 10, quantity: 5, date: DateTime.parse("2021-03-16T20:20:13Z") }
|
85
|
+
])
|
86
|
+
|
87
|
+
# End Versioned API Example 5
|
88
|
+
|
89
|
+
expect do
|
90
|
+
client.database.command(count: :sales)
|
91
|
+
end.to raise_error(Mongo::Error::OperationFailure)
|
92
|
+
|
93
|
+
# Start Versioned API Example 6
|
94
|
+
|
95
|
+
# Mongo::Error::OperationFailure:
|
96
|
+
# [323:APIStrictError]: Provided apiStrict:true, but the command count is not in API Version 1. Information on supported commands and migrations in API Version 1 can be found at https://dochub.mongodb.org/core/manual-versioned-api
|
97
|
+
|
98
|
+
# End Versioned API Example 6
|
99
|
+
|
100
|
+
# Start Versioned API Example 7
|
101
|
+
|
102
|
+
client[:sales].count_documents
|
103
|
+
|
104
|
+
# End Versioned API Example 7
|
105
|
+
|
106
|
+
# Start Versioned API Example 8
|
107
|
+
|
108
|
+
# 8
|
109
|
+
|
110
|
+
# End Versioned API Example 8
|
111
|
+
# Do not leak clients.
|
112
|
+
client.close
|
113
|
+
end
|
69
114
|
end
|
@@ -38,7 +38,7 @@ describe 'X.509 auth integration tests' do
|
|
38
38
|
"C=US,ST=New York,L=New York City,O=MongoDB,OU=x509,CN=localhost".freeze
|
39
39
|
end
|
40
40
|
|
41
|
-
let(:subscriber) { EventSubscriber.new }
|
41
|
+
let(:subscriber) { Mrss::EventSubscriber.new }
|
42
42
|
|
43
43
|
shared_examples 'authenticates successfully' do
|
44
44
|
it 'authenticates successfully' do
|