mongo 2.5.3 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/LICENSE +1 -1
- data/README.md +3 -2
- data/lib/mongo.rb +2 -2
- data/lib/mongo/address.rb +10 -2
- data/lib/mongo/address/ipv4.rb +1 -1
- data/lib/mongo/address/ipv6.rb +26 -5
- data/lib/mongo/address/unix.rb +1 -1
- data/lib/mongo/auth.rb +10 -3
- data/lib/mongo/auth/cr.rb +4 -1
- data/lib/mongo/auth/cr/conversation.rb +4 -1
- data/lib/mongo/auth/ldap.rb +1 -1
- data/lib/mongo/auth/ldap/conversation.rb +1 -1
- data/lib/mongo/auth/roles.rb +1 -1
- data/lib/mongo/auth/scram.rb +24 -7
- data/lib/mongo/auth/scram/conversation.rb +52 -19
- data/lib/mongo/auth/stringprep.rb +114 -0
- data/lib/mongo/auth/stringprep/profiles/sasl.rb +73 -0
- data/lib/mongo/auth/stringprep/tables.rb +3232 -0
- data/lib/mongo/auth/stringprep/unicode_normalize/normalize.rb +174 -0
- data/lib/mongo/auth/stringprep/unicode_normalize/tables.rb +1170 -0
- data/lib/mongo/auth/user.rb +14 -3
- data/lib/mongo/auth/user/view.rb +1 -1
- data/lib/mongo/auth/x509.rb +1 -1
- data/lib/mongo/auth/x509/conversation.rb +1 -1
- data/lib/mongo/bson.rb +1 -1
- data/lib/mongo/bulk_write.rb +8 -8
- data/lib/mongo/bulk_write/combineable.rb +1 -1
- data/lib/mongo/bulk_write/ordered_combiner.rb +1 -1
- data/lib/mongo/bulk_write/result.rb +1 -1
- data/lib/mongo/bulk_write/result_combiner.rb +4 -4
- data/lib/mongo/bulk_write/transformable.rb +1 -1
- data/lib/mongo/bulk_write/unordered_combiner.rb +1 -1
- data/lib/mongo/bulk_write/validatable.rb +1 -1
- data/lib/mongo/client.rb +115 -24
- data/lib/mongo/cluster.rb +17 -10
- data/lib/mongo/cluster/app_metadata.rb +7 -1
- data/lib/mongo/cluster/periodic_executor.rb +1 -1
- data/lib/mongo/cluster/reapers/socket_reaper.rb +1 -1
- data/lib/mongo/cluster/topology.rb +12 -2
- data/lib/mongo/cluster/topology/replica_set.rb +9 -1
- data/lib/mongo/cluster/topology/sharded.rb +1 -1
- data/lib/mongo/cluster/topology/single.rb +1 -1
- data/lib/mongo/cluster/topology/unknown.rb +1 -1
- data/lib/mongo/collection.rb +75 -19
- data/lib/mongo/collection/view.rb +1 -1
- data/lib/mongo/collection/view/aggregation.rb +1 -1
- data/lib/mongo/collection/view/builder.rb +1 -1
- data/lib/mongo/collection/view/builder/aggregation.rb +3 -3
- data/lib/mongo/collection/view/builder/find_command.rb +1 -1
- data/lib/mongo/collection/view/builder/flags.rb +1 -1
- data/lib/mongo/collection/view/builder/map_reduce.rb +1 -1
- data/lib/mongo/collection/view/builder/modifiers.rb +1 -1
- data/lib/mongo/collection/view/builder/op_query.rb +1 -1
- data/lib/mongo/collection/view/change_stream.rb +193 -17
- data/lib/mongo/collection/view/change_stream/retryable.rb +3 -20
- data/lib/mongo/collection/view/explainable.rb +1 -1
- data/lib/mongo/collection/view/immutable.rb +1 -1
- data/lib/mongo/collection/view/iterable.rb +2 -2
- data/lib/mongo/collection/view/map_reduce.rb +1 -1
- data/lib/mongo/collection/view/readable.rb +108 -29
- data/lib/mongo/collection/view/writable.rb +3 -3
- data/lib/mongo/cursor.rb +44 -4
- data/lib/mongo/cursor/builder.rb +1 -1
- data/lib/mongo/cursor/builder/get_more_command.rb +1 -1
- data/lib/mongo/cursor/builder/kill_cursors_command.rb +1 -1
- data/lib/mongo/cursor/builder/op_get_more.rb +1 -1
- data/lib/mongo/cursor/builder/op_kill_cursors.rb +1 -1
- data/lib/mongo/database.rb +46 -3
- data/lib/mongo/database/view.rb +11 -11
- data/lib/mongo/dbref.rb +1 -1
- data/lib/mongo/error.rb +57 -1
- data/lib/mongo/error/bulk_write_error.rb +2 -2
- data/lib/mongo/error/change_stream_resumable.rb +37 -0
- data/lib/mongo/error/closed_stream.rb +1 -1
- data/lib/mongo/error/extra_file_chunk.rb +1 -1
- data/lib/mongo/error/failed_stringprep_validation.rb +38 -0
- data/lib/mongo/error/file_not_found.rb +1 -1
- data/lib/mongo/error/insufficient_iteration_count.rb +38 -0
- data/lib/mongo/error/invalid_application_name.rb +1 -1
- data/lib/mongo/error/invalid_bulk_operation.rb +1 -1
- data/lib/mongo/error/invalid_bulk_operation_type.rb +1 -1
- data/lib/mongo/error/invalid_collection_name.rb +1 -1
- data/lib/mongo/error/invalid_database_name.rb +1 -1
- data/lib/mongo/error/invalid_document.rb +1 -1
- data/lib/mongo/error/invalid_file.rb +1 -1
- data/lib/mongo/error/invalid_file_revision.rb +1 -1
- data/lib/mongo/error/invalid_min_pool_size.rb +1 -1
- data/lib/mongo/error/invalid_nonce.rb +1 -1
- data/lib/mongo/error/invalid_read_option.rb +35 -0
- data/lib/mongo/error/invalid_replacement_document.rb +1 -1
- data/lib/mongo/error/invalid_server_preference.rb +1 -1
- data/lib/mongo/error/invalid_session.rb +1 -1
- data/lib/mongo/error/invalid_signature.rb +1 -1
- data/lib/mongo/error/invalid_transaction_operation.rb +82 -0
- data/lib/mongo/error/invalid_txt_record.rb +1 -1
- data/lib/mongo/error/invalid_update_document.rb +1 -1
- data/lib/mongo/error/invalid_uri.rb +1 -1
- data/lib/mongo/error/invalid_write_concern.rb +1 -1
- data/lib/mongo/error/max_bson_size.rb +1 -1
- data/lib/mongo/error/max_message_size.rb +1 -1
- data/lib/mongo/error/mismatched_domain.rb +1 -1
- data/lib/mongo/error/missing_file_chunk.rb +1 -1
- data/lib/mongo/error/missing_resume_token.rb +1 -1
- data/lib/mongo/error/multi_index_drop.rb +1 -1
- data/lib/mongo/error/need_primary_server.rb +1 -1
- data/lib/mongo/error/no_server_available.rb +1 -1
- data/lib/mongo/error/no_srv_records.rb +1 -1
- data/lib/mongo/error/operation_failure.rb +108 -14
- data/lib/mongo/error/parser.rb +50 -1
- data/lib/mongo/error/socket_error.rb +5 -2
- data/lib/mongo/error/socket_timeout_error.rb +5 -2
- data/lib/mongo/error/unchangeable_collection_option.rb +1 -1
- data/lib/mongo/error/unexpected_chunk_length.rb +1 -1
- data/lib/mongo/error/unexpected_response.rb +1 -1
- data/lib/mongo/error/unknown_payload_type.rb +1 -1
- data/lib/mongo/error/unsupported_array_filters.rb +1 -1
- data/lib/mongo/error/unsupported_collation.rb +1 -1
- data/lib/mongo/error/unsupported_features.rb +1 -1
- data/lib/mongo/error/unsupported_message_type.rb +1 -1
- data/lib/mongo/error/write_retryable.rb +27 -0
- data/lib/mongo/event.rb +10 -9
- data/lib/mongo/event/base.rb +33 -0
- data/lib/mongo/event/description_changed.rb +2 -2
- data/lib/mongo/event/listeners.rb +1 -1
- data/lib/mongo/event/member_discovered.rb +4 -2
- data/lib/mongo/event/primary_elected.rb +2 -2
- data/lib/mongo/event/publisher.rb +1 -1
- data/lib/mongo/event/standalone_discovered.rb +2 -2
- data/lib/mongo/event/subscriber.rb +1 -1
- data/lib/mongo/grid.rb +1 -1
- data/lib/mongo/grid/file.rb +1 -1
- data/lib/mongo/grid/file/chunk.rb +3 -3
- data/lib/mongo/grid/file/info.rb +26 -3
- data/lib/mongo/grid/fs_bucket.rb +1 -1
- data/lib/mongo/grid/stream.rb +1 -1
- data/lib/mongo/grid/stream/read.rb +1 -1
- data/lib/mongo/grid/stream/write.rb +1 -1
- data/lib/mongo/index.rb +1 -1
- data/lib/mongo/index/view.rb +1 -1
- data/lib/mongo/loggable.rb +1 -1
- data/lib/mongo/logger.rb +1 -1
- data/lib/mongo/monitoring.rb +99 -62
- data/lib/mongo/monitoring/command_log_subscriber.rb +2 -2
- data/lib/mongo/monitoring/event.rb +2 -1
- data/lib/mongo/monitoring/event/command_failed.rb +19 -6
- data/lib/mongo/monitoring/event/command_started.rb +14 -3
- data/lib/mongo/monitoring/event/command_succeeded.rb +5 -3
- data/lib/mongo/monitoring/event/secure.rb +1 -1
- data/lib/mongo/monitoring/event/server_closed.rb +2 -2
- data/lib/mongo/monitoring/event/server_description_changed.rb +2 -2
- data/lib/mongo/monitoring/event/server_opening.rb +11 -2
- data/lib/mongo/monitoring/event/topology_changed.rb +13 -2
- data/lib/mongo/monitoring/event/topology_closed.rb +2 -2
- data/lib/mongo/monitoring/event/topology_opening.rb +11 -2
- data/lib/mongo/monitoring/publishable.rb +10 -6
- data/lib/mongo/monitoring/sdam_log_subscriber.rb +1 -1
- data/lib/mongo/monitoring/server_closed_log_subscriber.rb +1 -1
- data/lib/mongo/monitoring/server_description_changed_log_subscriber.rb +1 -1
- data/lib/mongo/monitoring/server_opening_log_subscriber.rb +1 -1
- data/lib/mongo/monitoring/topology_changed_log_subscriber.rb +1 -1
- data/lib/mongo/monitoring/topology_opening_log_subscriber.rb +1 -1
- data/lib/mongo/operation/aggregate/op_msg.rb +3 -0
- data/lib/mongo/operation/create/op_msg.rb +9 -0
- data/lib/mongo/operation/create_index/op_msg.rb +9 -0
- data/lib/mongo/operation/create_user/command.rb +1 -1
- data/lib/mongo/operation/create_user/op_msg.rb +10 -1
- data/lib/mongo/operation/delete/op_msg.rb +3 -0
- data/lib/mongo/operation/distinct/op_msg.rb +9 -0
- data/lib/mongo/operation/drop/op_msg.rb +9 -0
- data/lib/mongo/operation/drop_database/op_msg.rb +9 -0
- data/lib/mongo/operation/drop_index/op_msg.rb +9 -0
- data/lib/mongo/operation/explain/op_msg.rb +3 -0
- data/lib/mongo/operation/find/op_msg.rb +3 -0
- data/lib/mongo/operation/get_more.rb +1 -1
- data/lib/mongo/operation/get_more/command.rb +1 -1
- data/lib/mongo/operation/get_more/legacy.rb +1 -1
- data/lib/mongo/operation/get_more/op_msg.rb +3 -0
- data/lib/mongo/operation/indexes/op_msg.rb +3 -0
- data/lib/mongo/operation/indexes/result.rb +1 -1
- data/lib/mongo/operation/insert/bulk_result.rb +32 -2
- data/lib/mongo/operation/insert/op_msg.rb +3 -0
- data/lib/mongo/operation/insert/result.rb +1 -1
- data/lib/mongo/operation/kill_cursors/op_msg.rb +9 -0
- data/lib/mongo/operation/list_collections/op_msg.rb +3 -0
- data/lib/mongo/operation/list_collections/result.rb +5 -1
- data/lib/mongo/operation/map_reduce/op_msg.rb +3 -0
- data/lib/mongo/operation/map_reduce/result.rb +1 -1
- data/lib/mongo/operation/parallel_scan/op_msg.rb +3 -0
- data/lib/mongo/operation/remove_user/op_msg.rb +9 -0
- data/lib/mongo/operation/result.rb +27 -14
- data/lib/mongo/operation/shared/executable.rb +1 -0
- data/lib/mongo/operation/shared/sessions_supported.rb +78 -7
- data/lib/mongo/operation/shared/specifiable.rb +18 -2
- data/lib/mongo/operation/shared/write_concern_supported.rb +1 -1
- data/lib/mongo/operation/update/op_msg.rb +3 -0
- data/lib/mongo/operation/update_user/command.rb +1 -1
- data/lib/mongo/operation/update_user/op_msg.rb +10 -1
- data/lib/mongo/operation/users_info/op_msg.rb +3 -0
- data/lib/mongo/options.rb +1 -1
- data/lib/mongo/options/mapper.rb +1 -1
- data/lib/mongo/options/redacted.rb +1 -1
- data/lib/mongo/protocol/bit_vector.rb +1 -1
- data/lib/mongo/protocol/compressed.rb +1 -1
- data/lib/mongo/protocol/delete.rb +1 -1
- data/lib/mongo/protocol/get_more.rb +7 -7
- data/lib/mongo/protocol/insert.rb +1 -1
- data/lib/mongo/protocol/kill_cursors.rb +1 -1
- data/lib/mongo/protocol/message.rb +5 -5
- data/lib/mongo/protocol/msg.rb +9 -7
- data/lib/mongo/protocol/query.rb +1 -1
- data/lib/mongo/protocol/registry.rb +1 -1
- data/lib/mongo/protocol/reply.rb +10 -10
- data/lib/mongo/protocol/serializers.rb +1 -1
- data/lib/mongo/protocol/update.rb +1 -1
- data/lib/mongo/retryable.rb +22 -14
- data/lib/mongo/server.rb +1 -1
- data/lib/mongo/server/connectable.rb +1 -1
- data/lib/mongo/server/connection.rb +16 -4
- data/lib/mongo/server/connection_pool.rb +1 -1
- data/lib/mongo/server/connection_pool/queue.rb +1 -1
- data/lib/mongo/server/context.rb +1 -1
- data/lib/mongo/server/description.rb +14 -2
- data/lib/mongo/server/description/features.rb +10 -9
- data/lib/mongo/server/description/inspector.rb +1 -1
- data/lib/mongo/server/description/inspector/description_changed.rb +1 -1
- data/lib/mongo/server/description/inspector/member_discovered.rb +1 -1
- data/lib/mongo/server/description/inspector/primary_elected.rb +1 -1
- data/lib/mongo/server/description/inspector/standalone_discovered.rb +1 -1
- data/lib/mongo/server/monitor.rb +15 -3
- data/lib/mongo/server/monitor/connection.rb +1 -1
- data/lib/mongo/server_selector.rb +1 -1
- data/lib/mongo/server_selector/nearest.rb +1 -1
- data/lib/mongo/server_selector/primary.rb +1 -1
- data/lib/mongo/server_selector/primary_preferred.rb +1 -1
- data/lib/mongo/server_selector/secondary.rb +1 -1
- data/lib/mongo/server_selector/secondary_preferred.rb +1 -1
- data/lib/mongo/server_selector/selectable.rb +7 -2
- data/lib/mongo/session.rb +389 -12
- data/lib/mongo/session/server_session.rb +7 -2
- data/lib/mongo/session/session_pool.rb +1 -1
- data/lib/mongo/socket.rb +1 -1
- data/lib/mongo/socket/ssl.rb +1 -1
- data/lib/mongo/socket/tcp.rb +1 -1
- data/lib/mongo/socket/unix.rb +1 -1
- data/lib/mongo/uri.rb +6 -4
- data/lib/mongo/uri/srv_protocol.rb +1 -1
- data/lib/mongo/version.rb +2 -2
- data/lib/mongo/write_concern.rb +1 -1
- data/lib/mongo/write_concern/acknowledged.rb +1 -1
- data/lib/mongo/write_concern/normalizable.rb +1 -1
- data/lib/mongo/write_concern/unacknowledged.rb +1 -1
- data/mongo.gemspec +4 -1
- data/spec/atlas/atlas_connectivity_spec.rb +54 -0
- data/spec/integration/bulk_insert_spec.rb +78 -0
- data/spec/integration/change_stream_spec.rb +365 -0
- data/spec/integration/command_monitoring_spec.rb +92 -0
- data/spec/lite_spec_helper.rb +63 -0
- data/spec/mongo/address/ipv6_spec.rb +29 -1
- data/spec/mongo/address_spec.rb +34 -0
- data/spec/mongo/auth/scram/conversation_spec.rb +326 -120
- data/spec/mongo/auth/scram/negotiation_spec.rb +574 -0
- data/spec/mongo/auth/scram_spec.rb +107 -38
- data/spec/mongo/auth/stringprep/profiles/sasl_spec.rb +113 -0
- data/spec/mongo/auth/stringprep_spec.rb +188 -0
- data/spec/mongo/auth/user/view_spec.rb +5 -2
- data/spec/mongo/auth/user_spec.rb +1 -1
- data/spec/mongo/bulk_write/result_spec.rb +120 -0
- data/spec/mongo/bulk_write_spec.rb +42 -2
- data/spec/mongo/client_spec.rb +121 -9
- data/spec/mongo/cluster/app_metadata_spec.rb +14 -1
- data/spec/mongo/cluster/topology_spec.rb +1 -23
- data/spec/mongo/collection/view/change_stream_spec.rb +62 -180
- data/spec/mongo/collection_spec.rb +45 -12
- data/spec/mongo/cursor/builder/get_more_command_spec.rb +7 -7
- data/spec/mongo/cursor_spec.rb +2 -2
- data/spec/mongo/database_spec.rb +3 -3
- data/spec/mongo/docs_examples_spec.rb +194 -0
- data/spec/mongo/error/operation_failure_spec.rb +152 -0
- data/spec/mongo/error/parser_spec.rb +127 -0
- data/spec/mongo/grid/fs_bucket_spec.rb +32 -0
- data/spec/mongo/grid/stream/write_spec.rb +40 -1
- data/spec/mongo/monitoring/event/command_failed_spec.rb +30 -0
- data/spec/mongo/monitoring/event/command_started_spec.rb +26 -4
- data/spec/mongo/monitoring/event/command_succeeded_spec.rb +29 -7
- data/spec/mongo/monitoring_spec.rb +28 -3
- data/spec/mongo/protocol/get_more_spec.rb +2 -2
- data/spec/mongo/retryable_spec.rb +252 -34
- data/spec/mongo/retryable_writes_spec.rb +468 -544
- data/spec/mongo/server/connection_spec.rb +5 -5
- data/spec/mongo/server/description_spec.rb +23 -6
- data/spec/mongo/session/server_session_spec.rb +2 -2
- data/spec/mongo/session/session_pool_spec.rb +2 -2
- data/spec/mongo/transactions_examples_spec.rb +227 -0
- data/spec/mongo/transactions_spec.rb +44 -0
- data/spec/spec_helper.rb +135 -49
- data/spec/spec_tests/change_streams_spec.rb +42 -0
- data/spec/{mongo → spec_tests}/command_monitoring_spec.rb +8 -2
- data/spec/{mongo → spec_tests}/connection_string_spec.rb +1 -1
- data/spec/{mongo → spec_tests}/crud_spec.rb +5 -7
- data/spec/{mongo → spec_tests}/dns_seedlist_discovery_spec.rb +1 -1
- data/spec/{mongo → spec_tests}/gridfs_spec.rb +0 -0
- data/spec/{mongo → spec_tests}/max_staleness_spec.rb +0 -0
- data/spec/spec_tests/retryable_writes_spec.rb +78 -0
- data/spec/{mongo → spec_tests}/sdam_monitoring_spec.rb +4 -3
- data/spec/{mongo → spec_tests}/sdam_spec.rb +7 -7
- data/spec/{mongo → spec_tests}/server_selection_rtt_spec.rb +0 -0
- data/spec/{mongo → spec_tests}/server_selection_spec.rb +0 -0
- data/spec/support/authorization.rb +18 -6
- data/spec/support/change_streams.rb +265 -0
- data/spec/support/change_streams/operation.rb +62 -0
- data/spec/support/change_streams_tests/change-streams-errors.yml +53 -0
- data/spec/support/change_streams_tests/change-streams.yml +299 -0
- data/spec/support/command_monitoring.rb +1 -1
- data/spec/support/command_monitoring/bulkWrite.yml +4 -28
- data/spec/support/command_monitoring/command.yml +19 -0
- data/spec/support/command_monitoring/find.yml +17 -19
- data/spec/support/command_monitoring/insertMany.yml +2 -8
- data/spec/support/command_monitoring/unacknowledgedBulkWrite.yml +34 -0
- data/spec/support/connection_string.rb +1 -1
- data/spec/support/constraints.rb +56 -0
- data/spec/support/crud.rb +9 -4
- data/spec/support/crud/read.rb +24 -3
- data/spec/support/crud/write.rb +7 -2
- data/spec/support/crud_tests/read/count-collation.yml +12 -2
- data/spec/support/crud_tests/read/count.yml +43 -5
- data/spec/support/gridfs.rb +1 -1
- data/spec/support/primary_socket.rb +21 -0
- data/spec/support/retryable_writes_tests/bulkWrite-serverErrors.yml +90 -0
- data/spec/support/retryable_writes_tests/bulkWrite.yml +99 -1
- data/spec/support/retryable_writes_tests/deleteOne-serverErrors.yml +50 -0
- data/spec/support/retryable_writes_tests/deleteOne.yml +10 -1
- data/spec/support/retryable_writes_tests/findOneAndDelete-serverErrors.yml +50 -0
- data/spec/support/retryable_writes_tests/findOneAndDelete.yml +39 -30
- data/spec/support/retryable_writes_tests/findOneAndReplace-serverErrors.yml +54 -0
- data/spec/support/retryable_writes_tests/findOneAndReplace.yml +9 -0
- data/spec/support/retryable_writes_tests/findOneAndUpdate-serverErrors.yml +54 -0
- data/spec/support/retryable_writes_tests/findOneAndUpdate.yml +9 -0
- data/spec/support/retryable_writes_tests/insertMany-serverErrors.yml +59 -0
- data/spec/support/retryable_writes_tests/insertMany.yml +11 -6
- data/spec/support/retryable_writes_tests/insertOne-serverErrors.yml +471 -0
- data/spec/support/retryable_writes_tests/insertOne.yml +9 -0
- data/spec/support/retryable_writes_tests/replaceOne-serverErrors.yml +58 -0
- data/spec/support/retryable_writes_tests/replaceOne.yml +9 -0
- data/spec/support/retryable_writes_tests/updateOne-serverErrors.yml +58 -0
- data/spec/support/retryable_writes_tests/updateOne.yml +71 -53
- data/spec/support/sdam/rs/normalize_case_me.yml +100 -0
- data/spec/support/sdam/sharded/compatible.yml +38 -0
- data/spec/support/sdam/sharded/mongos_disconnect.yml +9 -3
- data/spec/support/sdam/sharded/multiple_mongoses.yml +6 -2
- data/spec/support/sdam/sharded/non_mongos_removed.yml +6 -2
- data/spec/support/sdam/sharded/too_new.yml +36 -0
- data/spec/support/sdam/sharded/too_old.yml +36 -0
- data/spec/support/sdam/single/compatible.yml +26 -0
- data/spec/support/sdam/single/direct_connection_external_ip.yml +3 -1
- data/spec/support/sdam/single/direct_connection_mongos.yml +3 -1
- data/spec/support/sdam/single/direct_connection_rsarbiter.yml +3 -1
- data/spec/support/sdam/single/direct_connection_rsprimary.yml +3 -1
- data/spec/support/sdam/single/direct_connection_rssecondary.yml +3 -1
- data/spec/support/sdam/single/direct_connection_slave.yml +3 -1
- data/spec/support/sdam/single/direct_connection_standalone.yml +3 -1
- data/spec/support/sdam/single/not_ok_response.yml +6 -2
- data/spec/support/sdam/single/standalone_removed.yml +3 -1
- data/spec/support/sdam/single/too_new.yml +26 -0
- data/spec/support/sdam/single/too_old.yml +24 -0
- data/spec/support/shared/session.rb +107 -0
- data/spec/support/transactions.rb +391 -0
- data/spec/support/transactions/operation.rb +373 -0
- data/spec/support/transactions_tests/abort.yml +403 -0
- data/spec/support/transactions_tests/bulk.yml +267 -0
- data/spec/support/transactions_tests/causal-consistency.yml +173 -0
- data/spec/support/transactions_tests/commit.yml +593 -0
- data/spec/support/transactions_tests/delete.yml +184 -0
- data/spec/support/transactions_tests/error-labels.yml +948 -0
- data/spec/support/transactions_tests/errors.yml +125 -0
- data/spec/support/transactions_tests/findOneAndDelete.yml +126 -0
- data/spec/support/transactions_tests/findOneAndReplace.yml +140 -0
- data/spec/support/transactions_tests/findOneAndUpdate.yml +228 -0
- data/spec/support/transactions_tests/insert.yml +264 -0
- data/spec/support/transactions_tests/isolation.yml +125 -0
- data/spec/support/transactions_tests/read-pref.yml +340 -0
- data/spec/support/transactions_tests/reads.yml +298 -0
- data/spec/support/transactions_tests/retryable-abort.yml +1292 -0
- data/spec/support/transactions_tests/retryable-commit.yml +1332 -0
- data/spec/support/transactions_tests/retryable-writes.yml +208 -0
- data/spec/support/transactions_tests/run-command.yml +189 -0
- data/spec/support/transactions_tests/transaction-options.yml +877 -0
- data/spec/support/transactions_tests/update.yml +246 -0
- data/spec/support/transactions_tests/write-concern.yml +236 -0
- metadata +494 -359
- metadata.gz.sig +0 -0
- data/lib/csasl/csasl.bundle +0 -0
@@ -19,10 +19,11 @@ describe Mongo::Collection::View::ChangeStream, if: test_change_streams? do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
let(:change_stream) do
|
22
|
-
described_class.new(view, pipeline, options)
|
22
|
+
described_class.new(view, pipeline, nil, options)
|
23
23
|
end
|
24
24
|
|
25
25
|
let(:change_stream_document) do
|
26
|
+
change_stream.send(:instance_variable_set, '@resuming', false)
|
26
27
|
change_stream.send(:pipeline)[0]['$changeStream']
|
27
28
|
end
|
28
29
|
|
@@ -39,6 +40,7 @@ describe Mongo::Collection::View::ChangeStream, if: test_change_streams? do
|
|
39
40
|
end
|
40
41
|
|
41
42
|
let(:command_spec) do
|
43
|
+
change_stream.send(:instance_variable_set, '@resuming', false)
|
42
44
|
change_stream.send(:aggregate_spec, double('session'))
|
43
45
|
end
|
44
46
|
|
@@ -372,7 +374,7 @@ describe Mongo::Collection::View::ChangeStream, if: test_change_streams? do
|
|
372
374
|
end
|
373
375
|
end
|
374
376
|
|
375
|
-
context 'when some documents have been retrieved and the stream is closed before sending
|
377
|
+
context 'when some documents have been retrieved and the stream is closed before sending getMore' do
|
376
378
|
|
377
379
|
before do
|
378
380
|
change_stream
|
@@ -434,103 +436,29 @@ describe Mongo::Collection::View::ChangeStream, if: test_change_streams? do
|
|
434
436
|
end
|
435
437
|
|
436
438
|
context 'when an error is encountered the first time the command is run' do
|
439
|
+
include PrimarySocket
|
437
440
|
|
438
|
-
let(:
|
439
|
-
primary = authorized_collection.client.cluster.servers.find { |s| s.primary? }
|
440
|
-
connection = primary.pool.checkout
|
441
|
-
primary.pool.checkin(connection)
|
442
|
-
connection.send(:socket)
|
443
|
-
end
|
444
|
-
|
445
|
-
context 'when the error is a resumable error' do
|
446
|
-
|
447
|
-
shared_examples_for 'a resumable change stream' do
|
448
|
-
|
449
|
-
before do
|
450
|
-
expect(primary_socket).to receive(:write).and_raise(error).once
|
451
|
-
expect(view.send(:server_selector)).to receive(:select_server).twice.and_call_original
|
452
|
-
change_stream
|
453
|
-
authorized_collection.insert_one(a: 1)
|
454
|
-
end
|
455
|
-
|
456
|
-
let(:document) do
|
457
|
-
change_stream.to_enum.next
|
458
|
-
end
|
459
|
-
|
460
|
-
it 'runs the command again while using the same read preference and caches the resume token' do
|
461
|
-
expect(document[:fullDocument][:a]).to eq(1)
|
462
|
-
expect(change_stream_document[:resumeAfter]).to eq(document[:_id])
|
463
|
-
end
|
464
|
-
|
465
|
-
context 'when provided a session' do
|
466
|
-
|
467
|
-
let(:options) do
|
468
|
-
{ session: session}
|
469
|
-
end
|
470
|
-
|
471
|
-
let(:session) do
|
472
|
-
authorized_client.start_session
|
473
|
-
end
|
474
|
-
|
475
|
-
before do
|
476
|
-
change_stream.to_enum.next
|
477
|
-
end
|
441
|
+
let(:client) { authorized_collection.client }
|
478
442
|
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
end
|
483
|
-
end
|
484
|
-
|
485
|
-
context 'when the error is a SocketError' do
|
486
|
-
|
487
|
-
let(:error) do
|
488
|
-
Mongo::Error::SocketError
|
489
|
-
end
|
490
|
-
|
491
|
-
it_behaves_like 'a resumable change stream'
|
492
|
-
end
|
493
|
-
|
494
|
-
context 'when the error is a SocketTimeoutError' do
|
495
|
-
|
496
|
-
let(:error) do
|
497
|
-
Mongo::Error::SocketTimeoutError
|
498
|
-
end
|
499
|
-
|
500
|
-
it_behaves_like 'a resumable change stream'
|
501
|
-
end
|
502
|
-
|
503
|
-
context "when the error is a 'not master' error" do
|
504
|
-
|
505
|
-
let(:error) do
|
506
|
-
Mongo::Error::OperationFailure.new('not master')
|
507
|
-
end
|
508
|
-
|
509
|
-
it_behaves_like 'a resumable change stream'
|
510
|
-
end
|
511
|
-
|
512
|
-
context "when the error is a 'cursor not found (43)' error" do
|
513
|
-
|
514
|
-
let(:error) do
|
515
|
-
Mongo::Error::OperationFailure.new('cursor not found (43)')
|
516
|
-
end
|
443
|
+
before do
|
444
|
+
expect(primary_socket).to receive(:write).and_raise(error).once
|
445
|
+
end
|
517
446
|
|
518
|
-
|
519
|
-
|
447
|
+
let(:document) do
|
448
|
+
change_stream.to_enum.next
|
520
449
|
end
|
521
450
|
|
522
|
-
|
451
|
+
shared_examples_for 'a resumable change stream' do
|
523
452
|
|
524
453
|
before do
|
525
|
-
expect(primary_socket).to receive(:write).and_raise(Mongo::Error::OperationFailure)
|
526
|
-
#expect twice because of kill_cursors in after block
|
527
454
|
expect(view.send(:server_selector)).to receive(:select_server).twice.and_call_original
|
455
|
+
change_stream
|
456
|
+
authorized_collection.insert_one(a: 1)
|
528
457
|
end
|
529
458
|
|
530
|
-
it '
|
531
|
-
expect
|
532
|
-
|
533
|
-
}.to raise_exception(Mongo::Error::OperationFailure)
|
459
|
+
it 'runs the command again while using the same read preference and caches the resume token' do
|
460
|
+
expect(document[:fullDocument][:a]).to eq(1)
|
461
|
+
expect(change_stream_document[:resumeAfter]).to eq(document[:_id])
|
534
462
|
end
|
535
463
|
|
536
464
|
context 'when provided a session' do
|
@@ -544,7 +472,7 @@ describe Mongo::Collection::View::ChangeStream, if: test_change_streams? do
|
|
544
472
|
end
|
545
473
|
|
546
474
|
before do
|
547
|
-
|
475
|
+
change_stream.to_enum.next
|
548
476
|
end
|
549
477
|
|
550
478
|
it 'does not close the session' do
|
@@ -552,64 +480,24 @@ describe Mongo::Collection::View::ChangeStream, if: test_change_streams? do
|
|
552
480
|
end
|
553
481
|
end
|
554
482
|
end
|
555
|
-
end
|
556
483
|
|
557
|
-
|
484
|
+
shared_examples_for 'a non-resumed change stream' do
|
485
|
+
it 'does not run the command again and instead raises the error' do
|
486
|
+
expect do
|
487
|
+
document
|
488
|
+
end.to raise_exception(error)
|
489
|
+
end
|
490
|
+
end
|
558
491
|
|
559
492
|
context 'when the error is a resumable error' do
|
560
493
|
|
561
|
-
shared_examples_for 'a change stream that encounters an error from a getmore' do
|
562
|
-
|
563
|
-
before do
|
564
|
-
change_stream
|
565
|
-
authorized_collection.insert_one(a: 1)
|
566
|
-
enum.next
|
567
|
-
authorized_collection.insert_one(a: 2)
|
568
|
-
expect(cursor).to receive(:get_more).once.and_raise(error)
|
569
|
-
expect(cursor).to receive(:kill_cursors).and_call_original
|
570
|
-
expect(Mongo::Operation::Aggregate).to receive(:new).and_call_original
|
571
|
-
end
|
572
|
-
|
573
|
-
let(:enum) do
|
574
|
-
change_stream.to_enum
|
575
|
-
end
|
576
|
-
|
577
|
-
let(:document) do
|
578
|
-
enum.next
|
579
|
-
end
|
580
|
-
|
581
|
-
it 'runs the command again while using the same read preference and caching the resume token' do
|
582
|
-
expect(document[:fullDocument][:a]).to eq(2)
|
583
|
-
expect(change_stream_document[:resumeAfter]).to eq(document[:_id])
|
584
|
-
end
|
585
|
-
|
586
|
-
context 'when provided a session' do
|
587
|
-
|
588
|
-
let(:options) do
|
589
|
-
{ session: session}
|
590
|
-
end
|
591
|
-
|
592
|
-
let(:session) do
|
593
|
-
authorized_client.start_session
|
594
|
-
end
|
595
|
-
|
596
|
-
before do
|
597
|
-
enum.next
|
598
|
-
end
|
599
|
-
|
600
|
-
it 'does not close the session' do
|
601
|
-
expect(session.ended?).to be(false)
|
602
|
-
end
|
603
|
-
end
|
604
|
-
end
|
605
|
-
|
606
494
|
context 'when the error is a SocketError' do
|
607
495
|
|
608
496
|
let(:error) do
|
609
497
|
Mongo::Error::SocketError
|
610
498
|
end
|
611
499
|
|
612
|
-
it_behaves_like 'a change stream
|
500
|
+
it_behaves_like 'a non-resumed change stream'
|
613
501
|
end
|
614
502
|
|
615
503
|
context 'when the error is a SocketTimeoutError' do
|
@@ -618,49 +506,40 @@ describe Mongo::Collection::View::ChangeStream, if: test_change_streams? do
|
|
618
506
|
Mongo::Error::SocketTimeoutError
|
619
507
|
end
|
620
508
|
|
621
|
-
it_behaves_like 'a change stream
|
509
|
+
it_behaves_like 'a non-resumed change stream'
|
622
510
|
end
|
623
511
|
|
624
|
-
context "when the error is a not '
|
512
|
+
context "when the error is a 'not master' error" do
|
625
513
|
|
626
514
|
let(:error) do
|
627
515
|
Mongo::Error::OperationFailure.new('not master')
|
628
516
|
end
|
629
517
|
|
630
|
-
it_behaves_like 'a change stream
|
518
|
+
it_behaves_like 'a non-resumed change stream'
|
631
519
|
end
|
632
520
|
|
633
|
-
context "when the error is a
|
521
|
+
context "when the error is a 'node is recovering' error" do
|
634
522
|
|
635
523
|
let(:error) do
|
636
|
-
Mongo::Error::OperationFailure.new('
|
524
|
+
Mongo::Error::OperationFailure.new('node is recovering')
|
637
525
|
end
|
638
526
|
|
639
|
-
it_behaves_like 'a change stream
|
527
|
+
it_behaves_like 'a non-resumed change stream'
|
640
528
|
end
|
641
529
|
end
|
642
530
|
|
643
531
|
context 'when the error is another server error' do
|
644
532
|
|
645
|
-
|
646
|
-
|
647
|
-
authorized_collection.insert_one(a: 1)
|
648
|
-
enum.next
|
649
|
-
authorized_collection.insert_one(a: 2)
|
650
|
-
expect(cursor).to receive(:get_more).and_raise(Mongo::Error::OperationFailure)
|
651
|
-
expect(cursor).to receive(:kill_cursors).and_call_original
|
652
|
-
expect(Mongo::Operation::Aggregate).not_to receive(:new)
|
533
|
+
let(:error) do
|
534
|
+
Mongo::Error::MissingResumeToken
|
653
535
|
end
|
654
536
|
|
655
|
-
|
656
|
-
|
537
|
+
before do
|
538
|
+
#expect twice because of kill_cursors in after block
|
539
|
+
expect(view.send(:server_selector)).to receive(:select_server).twice.and_call_original
|
657
540
|
end
|
658
541
|
|
659
|
-
|
660
|
-
expect {
|
661
|
-
enum.next
|
662
|
-
}.to raise_exception(Mongo::Error::OperationFailure)
|
663
|
-
end
|
542
|
+
it_behaves_like 'a non-resumed change stream'
|
664
543
|
|
665
544
|
context 'when provided a session' do
|
666
545
|
|
@@ -673,7 +552,9 @@ describe Mongo::Collection::View::ChangeStream, if: test_change_streams? do
|
|
673
552
|
end
|
674
553
|
|
675
554
|
before do
|
676
|
-
|
555
|
+
expect do
|
556
|
+
change_stream
|
557
|
+
end.to raise_error(error)
|
677
558
|
end
|
678
559
|
|
679
560
|
it 'does not close the session' do
|
@@ -683,20 +564,20 @@ describe Mongo::Collection::View::ChangeStream, if: test_change_streams? do
|
|
683
564
|
end
|
684
565
|
end
|
685
566
|
|
686
|
-
context 'when a server error is encountered during
|
567
|
+
context 'when a server error is encountered during a getMore' do
|
687
568
|
|
688
569
|
context 'when the error is a resumable error' do
|
689
570
|
|
690
|
-
shared_examples_for 'a change stream that
|
571
|
+
shared_examples_for 'a change stream that encounters an error from a getMore' do
|
691
572
|
|
692
573
|
before do
|
693
574
|
change_stream
|
694
575
|
authorized_collection.insert_one(a: 1)
|
695
576
|
enum.next
|
696
577
|
authorized_collection.insert_one(a: 2)
|
697
|
-
expect(cursor).to receive(:get_more).and_raise(error)
|
578
|
+
expect(cursor).to receive(:get_more).once.and_raise(error)
|
698
579
|
expect(cursor).to receive(:kill_cursors).and_call_original
|
699
|
-
expect(
|
580
|
+
expect(Mongo::Operation::Aggregate).to receive(:new).and_call_original
|
700
581
|
end
|
701
582
|
|
702
583
|
let(:enum) do
|
@@ -707,10 +588,9 @@ describe Mongo::Collection::View::ChangeStream, if: test_change_streams? do
|
|
707
588
|
enum.next
|
708
589
|
end
|
709
590
|
|
710
|
-
it '
|
711
|
-
expect
|
712
|
-
|
713
|
-
}.to raise_exception(error)
|
591
|
+
it 'runs the command again while using the same read preference and caching the resume token' do
|
592
|
+
expect(document[:fullDocument][:a]).to eq(2)
|
593
|
+
expect(change_stream_document[:resumeAfter]).to eq(document[:_id])
|
714
594
|
end
|
715
595
|
|
716
596
|
context 'when provided a session' do
|
@@ -724,7 +604,7 @@ describe Mongo::Collection::View::ChangeStream, if: test_change_streams? do
|
|
724
604
|
end
|
725
605
|
|
726
606
|
before do
|
727
|
-
|
607
|
+
enum.next
|
728
608
|
end
|
729
609
|
|
730
610
|
it 'does not close the session' do
|
@@ -739,7 +619,7 @@ describe Mongo::Collection::View::ChangeStream, if: test_change_streams? do
|
|
739
619
|
Mongo::Error::SocketError
|
740
620
|
end
|
741
621
|
|
742
|
-
it_behaves_like 'a change stream that
|
622
|
+
it_behaves_like 'a change stream that encounters an error from a getMore'
|
743
623
|
end
|
744
624
|
|
745
625
|
context 'when the error is a SocketTimeoutError' do
|
@@ -748,25 +628,27 @@ describe Mongo::Collection::View::ChangeStream, if: test_change_streams? do
|
|
748
628
|
Mongo::Error::SocketTimeoutError
|
749
629
|
end
|
750
630
|
|
751
|
-
it_behaves_like 'a change stream that
|
631
|
+
it_behaves_like 'a change stream that encounters an error from a getMore'
|
752
632
|
end
|
753
633
|
|
754
|
-
context "when the error is
|
634
|
+
context "when the error is 'not master'" do
|
755
635
|
|
756
636
|
let(:error) do
|
757
|
-
Mongo::Error::OperationFailure.new('not master'
|
637
|
+
Mongo::Error::OperationFailure.new('not master',
|
638
|
+
Mongo::Operation::GetMore::Result.new([]))
|
758
639
|
end
|
759
640
|
|
760
|
-
it_behaves_like 'a change stream that
|
641
|
+
it_behaves_like 'a change stream that encounters an error from a getMore'
|
761
642
|
end
|
762
643
|
|
763
|
-
context "when the error is
|
644
|
+
context "when the error is 'node is recovering'" do
|
764
645
|
|
765
646
|
let(:error) do
|
766
|
-
Mongo::Error::OperationFailure.new('
|
647
|
+
Mongo::Error::OperationFailure.new('node is recovering',
|
648
|
+
Mongo::Operation::GetMore::Result.new([]))
|
767
649
|
end
|
768
650
|
|
769
|
-
it_behaves_like 'a change stream that
|
651
|
+
it_behaves_like 'a change stream that encounters an error from a getMore'
|
770
652
|
end
|
771
653
|
end
|
772
654
|
|
@@ -777,9 +659,9 @@ describe Mongo::Collection::View::ChangeStream, if: test_change_streams? do
|
|
777
659
|
authorized_collection.insert_one(a: 1)
|
778
660
|
enum.next
|
779
661
|
authorized_collection.insert_one(a: 2)
|
780
|
-
expect(cursor).to receive(:get_more).and_raise(Mongo::Error::
|
662
|
+
expect(cursor).to receive(:get_more).and_raise(Mongo::Error::MissingResumeToken)
|
781
663
|
expect(cursor).to receive(:kill_cursors).and_call_original
|
782
|
-
expect(
|
664
|
+
expect(Mongo::Operation::Aggregate).not_to receive(:new)
|
783
665
|
end
|
784
666
|
|
785
667
|
let(:enum) do
|
@@ -789,7 +671,7 @@ describe Mongo::Collection::View::ChangeStream, if: test_change_streams? do
|
|
789
671
|
it 'does not run the command again and instead raises the error' do
|
790
672
|
expect {
|
791
673
|
enum.next
|
792
|
-
}.to raise_exception(Mongo::Error::
|
674
|
+
}.to raise_exception(Mongo::Error::MissingResumeToken)
|
793
675
|
end
|
794
676
|
|
795
677
|
context 'when provided a session' do
|
@@ -691,7 +691,11 @@ describe Mongo::Collection do
|
|
691
691
|
end
|
692
692
|
|
693
693
|
it_behaves_like 'an operation using a session'
|
694
|
-
|
694
|
+
|
695
|
+
# Due to how rspec interprets nested `if: condition` guards, we can't use one to skip this
|
696
|
+
# test in the case that the server will override the write concern (preventing the expected
|
697
|
+
# failure), so we're forced to use a traditional conditional to avoid defining the test.
|
698
|
+
it_behaves_like 'a failed operation using a session' if can_set_write_concern?
|
695
699
|
end
|
696
700
|
|
697
701
|
context 'when the collection does not have a write concern set' do
|
@@ -708,7 +712,7 @@ describe Mongo::Collection do
|
|
708
712
|
expect(database.collection_names).to_not include('specs')
|
709
713
|
end
|
710
714
|
|
711
|
-
context 'when the collection does not exist' do
|
715
|
+
context 'when the collection does not exist', if: can_set_write_concern? do
|
712
716
|
|
713
717
|
it 'does not raise an error' do
|
714
718
|
expect(database['non-existent-coll'].drop).to be(false)
|
@@ -732,7 +736,7 @@ describe Mongo::Collection do
|
|
732
736
|
collection.drop
|
733
737
|
end
|
734
738
|
|
735
|
-
context 'when the server supports write concern on the drop command', if: collation_enabled? do
|
739
|
+
context 'when the server supports write concern on the drop command', if: collation_enabled? && can_set_write_concern? do
|
736
740
|
|
737
741
|
it 'applies the write concern' do
|
738
742
|
expect{
|
@@ -750,7 +754,7 @@ describe Mongo::Collection do
|
|
750
754
|
end
|
751
755
|
end
|
752
756
|
|
753
|
-
context 'when the collection does not exist' do
|
757
|
+
context 'when the collection does not exist', if: can_set_write_concern? do
|
754
758
|
|
755
759
|
it 'returns false' do
|
756
760
|
expect(collection.drop).to be(false)
|
@@ -913,14 +917,14 @@ describe Mongo::Collection do
|
|
913
917
|
|
914
918
|
let(:command) do
|
915
919
|
client[TEST_COLL].find({}, session: session).explain
|
916
|
-
EventSubscriber.started_events.find { |c| c.command_name ==
|
920
|
+
EventSubscriber.started_events.find { |c| c.command_name == 'explain' }.command
|
917
921
|
end
|
918
922
|
|
919
923
|
it 'sends the session id' do
|
920
924
|
expect(command['lsid']).to eq(session.session_id)
|
921
925
|
end
|
922
926
|
end
|
923
|
-
|
927
|
+
|
924
928
|
context 'when a session supporting causal consistency is used' do
|
925
929
|
|
926
930
|
let(:operation) do
|
@@ -1228,7 +1232,7 @@ describe Mongo::Collection do
|
|
1228
1232
|
end
|
1229
1233
|
|
1230
1234
|
let(:insert_events) do
|
1231
|
-
EventSubscriber.started_events.select { |e| e.command_name ==
|
1235
|
+
EventSubscriber.started_events.select { |e| e.command_name == 'insert' }
|
1232
1236
|
end
|
1233
1237
|
|
1234
1238
|
it 'sends the documents in one OP_MSG' do
|
@@ -1551,7 +1555,7 @@ describe Mongo::Collection do
|
|
1551
1555
|
it_behaves_like 'a failed operation using a session'
|
1552
1556
|
end
|
1553
1557
|
|
1554
|
-
context 'when batch size is specified' do
|
1558
|
+
context 'when batch size is specified', unless: need_to_skip_on_sharded_auth_40? do
|
1555
1559
|
|
1556
1560
|
let(:batch_size) { 1 }
|
1557
1561
|
|
@@ -1752,7 +1756,7 @@ describe Mongo::Collection do
|
|
1752
1756
|
|
1753
1757
|
let(:command) do
|
1754
1758
|
operation
|
1755
|
-
EventSubscriber.started_events.find { |cmd| cmd.command_name ==
|
1759
|
+
EventSubscriber.started_events.find { |cmd| cmd.command_name == 'count' }.command
|
1756
1760
|
end
|
1757
1761
|
|
1758
1762
|
it_behaves_like 'an operation supporting causally consistent reads'
|
@@ -1866,7 +1870,7 @@ describe Mongo::Collection do
|
|
1866
1870
|
|
1867
1871
|
let(:command) do
|
1868
1872
|
operation
|
1869
|
-
EventSubscriber.started_events.find { |cmd| cmd.command_name ==
|
1873
|
+
EventSubscriber.started_events.find { |cmd| cmd.command_name == 'distinct' }.command
|
1870
1874
|
end
|
1871
1875
|
|
1872
1876
|
it_behaves_like 'an operation supporting causally consistent reads'
|
@@ -2372,6 +2376,33 @@ describe Mongo::Collection do
|
|
2372
2376
|
it_behaves_like 'a failed operation using a session'
|
2373
2377
|
end
|
2374
2378
|
|
2379
|
+
context 'when a session is not provided' do
|
2380
|
+
let(:client) { subscribed_client }
|
2381
|
+
let(:collection) { client['test'] }
|
2382
|
+
|
2383
|
+
let(:cursors) do
|
2384
|
+
collection.parallel_scan(2)
|
2385
|
+
end
|
2386
|
+
|
2387
|
+
let(:operation) do
|
2388
|
+
cursors.reduce(0) { |total, cursor| total + cursor.to_a.size }
|
2389
|
+
end
|
2390
|
+
|
2391
|
+
let(:failed_operation) do
|
2392
|
+
collection.parallel_scan(-2)
|
2393
|
+
end
|
2394
|
+
|
2395
|
+
let(:command) do
|
2396
|
+
operation
|
2397
|
+
event = EventSubscriber.started_events.find { |cmd| cmd.command_name == 'parallelCollectionScan' }
|
2398
|
+
expect(event).not_to be_nil
|
2399
|
+
event.command
|
2400
|
+
end
|
2401
|
+
|
2402
|
+
it_behaves_like 'an operation not using a session'
|
2403
|
+
it_behaves_like 'a failed operation not using a session'
|
2404
|
+
end
|
2405
|
+
|
2375
2406
|
context 'when a session supporting causal consistency is used' do
|
2376
2407
|
|
2377
2408
|
let(:cursors) do
|
@@ -2384,7 +2415,9 @@ describe Mongo::Collection do
|
|
2384
2415
|
|
2385
2416
|
let(:command) do
|
2386
2417
|
operation
|
2387
|
-
EventSubscriber.started_events.find { |cmd| cmd.command_name ==
|
2418
|
+
event = EventSubscriber.started_events.find { |cmd| cmd.command_name == 'parallelCollectionScan' }
|
2419
|
+
expect(event).not_to be_nil
|
2420
|
+
event.command
|
2388
2421
|
end
|
2389
2422
|
|
2390
2423
|
it_behaves_like 'an operation supporting causally consistent reads'
|
@@ -3569,7 +3602,7 @@ describe Mongo::Collection do
|
|
3569
3602
|
end
|
3570
3603
|
|
3571
3604
|
let(:update_events) do
|
3572
|
-
EventSubscriber.started_events.select { |e| e.command_name ==
|
3605
|
+
EventSubscriber.started_events.select { |e| e.command_name == 'update' }
|
3573
3606
|
end
|
3574
3607
|
|
3575
3608
|
it 'sends the documents in one OP_MSG' do
|