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
@@ -0,0 +1,264 @@
|
|
1
|
+
database_name: &database_name "ruby-driver"
|
2
|
+
collection_name: &collection_name "transactions-tests"
|
3
|
+
|
4
|
+
data: []
|
5
|
+
|
6
|
+
tests:
|
7
|
+
- description: insert
|
8
|
+
|
9
|
+
operations:
|
10
|
+
- name: startTransaction
|
11
|
+
object: session0
|
12
|
+
- name: insertOne
|
13
|
+
object: collection
|
14
|
+
arguments:
|
15
|
+
session: session0
|
16
|
+
document:
|
17
|
+
_id: 1
|
18
|
+
result:
|
19
|
+
insertedId: 1
|
20
|
+
- name: insertMany
|
21
|
+
object: collection
|
22
|
+
arguments:
|
23
|
+
documents:
|
24
|
+
- _id: 2
|
25
|
+
- _id: 3
|
26
|
+
session: session0
|
27
|
+
result:
|
28
|
+
insertedIds: {0: 2, 1: 3}
|
29
|
+
- name: insertOne
|
30
|
+
object: collection
|
31
|
+
arguments:
|
32
|
+
session: session0
|
33
|
+
document:
|
34
|
+
_id: 4
|
35
|
+
result:
|
36
|
+
insertedId: 4
|
37
|
+
- name: commitTransaction
|
38
|
+
object: session0
|
39
|
+
- name: startTransaction
|
40
|
+
object: session0
|
41
|
+
- name: insertOne
|
42
|
+
object: collection
|
43
|
+
arguments:
|
44
|
+
session: session0
|
45
|
+
document:
|
46
|
+
_id: 5
|
47
|
+
result:
|
48
|
+
insertedId: 5
|
49
|
+
- name: commitTransaction
|
50
|
+
object: session0
|
51
|
+
|
52
|
+
expectations:
|
53
|
+
- command_started_event:
|
54
|
+
command:
|
55
|
+
insert: *collection_name
|
56
|
+
documents:
|
57
|
+
- _id: 1
|
58
|
+
ordered: true
|
59
|
+
readConcern:
|
60
|
+
lsid: session0
|
61
|
+
txnNumber:
|
62
|
+
$numberLong: "1"
|
63
|
+
startTransaction: true
|
64
|
+
autocommit: false
|
65
|
+
writeConcern:
|
66
|
+
command_name: insert
|
67
|
+
database_name: *database_name
|
68
|
+
- command_started_event:
|
69
|
+
command:
|
70
|
+
insert: *collection_name
|
71
|
+
documents:
|
72
|
+
- _id: 2
|
73
|
+
- _id: 3
|
74
|
+
ordered: true
|
75
|
+
lsid: session0
|
76
|
+
txnNumber:
|
77
|
+
$numberLong: "1"
|
78
|
+
startTransaction:
|
79
|
+
autocommit: false
|
80
|
+
writeConcern:
|
81
|
+
command_name: insert
|
82
|
+
database_name: *database_name
|
83
|
+
- command_started_event:
|
84
|
+
command:
|
85
|
+
insert: *collection_name
|
86
|
+
documents:
|
87
|
+
- _id: 4
|
88
|
+
ordered: true
|
89
|
+
lsid: session0
|
90
|
+
txnNumber:
|
91
|
+
$numberLong: "1"
|
92
|
+
autocommit: false
|
93
|
+
writeConcern:
|
94
|
+
command_name: insert
|
95
|
+
database_name: *database_name
|
96
|
+
- command_started_event:
|
97
|
+
command:
|
98
|
+
commitTransaction: 1
|
99
|
+
lsid: session0
|
100
|
+
txnNumber:
|
101
|
+
$numberLong: "1"
|
102
|
+
startTransaction:
|
103
|
+
autocommit: false
|
104
|
+
writeConcern:
|
105
|
+
command_name: commitTransaction
|
106
|
+
database_name: admin
|
107
|
+
- command_started_event:
|
108
|
+
command:
|
109
|
+
insert: *collection_name
|
110
|
+
documents:
|
111
|
+
- _id: 5
|
112
|
+
ordered: true
|
113
|
+
readConcern:
|
114
|
+
afterClusterTime: 42
|
115
|
+
lsid: session0
|
116
|
+
txnNumber:
|
117
|
+
$numberLong: "2"
|
118
|
+
startTransaction: true
|
119
|
+
autocommit: false
|
120
|
+
writeConcern:
|
121
|
+
command_name: insert
|
122
|
+
database_name: *database_name
|
123
|
+
- command_started_event:
|
124
|
+
command:
|
125
|
+
commitTransaction: 1
|
126
|
+
lsid: session0
|
127
|
+
txnNumber:
|
128
|
+
$numberLong: "2"
|
129
|
+
startTransaction:
|
130
|
+
autocommit: false
|
131
|
+
writeConcern:
|
132
|
+
command_name: commitTransaction
|
133
|
+
database_name: admin
|
134
|
+
|
135
|
+
outcome:
|
136
|
+
collection:
|
137
|
+
data:
|
138
|
+
- _id: 1
|
139
|
+
- _id: 2
|
140
|
+
- _id: 3
|
141
|
+
- _id: 4
|
142
|
+
- _id: 5
|
143
|
+
|
144
|
+
# This test proves that the driver parses the collectionOptions writeConcern.
|
145
|
+
- description: collection writeConcern without transaction
|
146
|
+
operations:
|
147
|
+
- name: insertOne
|
148
|
+
object: collection
|
149
|
+
collectionOptions:
|
150
|
+
writeConcern:
|
151
|
+
w: majority
|
152
|
+
arguments:
|
153
|
+
session: session0
|
154
|
+
document:
|
155
|
+
_id: 1
|
156
|
+
result:
|
157
|
+
insertedId: 1
|
158
|
+
|
159
|
+
expectations:
|
160
|
+
- command_started_event:
|
161
|
+
command:
|
162
|
+
insert: *collection_name
|
163
|
+
documents:
|
164
|
+
- _id: 1
|
165
|
+
ordered: true
|
166
|
+
readConcern:
|
167
|
+
lsid: session0
|
168
|
+
txnNumber:
|
169
|
+
startTransaction:
|
170
|
+
autocommit:
|
171
|
+
writeConcern:
|
172
|
+
w: majority
|
173
|
+
command_name: insert
|
174
|
+
database_name: *database_name
|
175
|
+
|
176
|
+
outcome:
|
177
|
+
collection:
|
178
|
+
data:
|
179
|
+
- _id: 1
|
180
|
+
|
181
|
+
- description: collection writeConcern ignored for insert
|
182
|
+
operations:
|
183
|
+
- name: startTransaction
|
184
|
+
object: session0
|
185
|
+
arguments:
|
186
|
+
options:
|
187
|
+
writeConcern:
|
188
|
+
w: majority
|
189
|
+
- name: insertOne
|
190
|
+
object: collection
|
191
|
+
collectionOptions:
|
192
|
+
writeConcern:
|
193
|
+
w: majority
|
194
|
+
arguments:
|
195
|
+
session: session0
|
196
|
+
document:
|
197
|
+
_id: 1
|
198
|
+
result:
|
199
|
+
insertedId: 1
|
200
|
+
- name: insertMany
|
201
|
+
object: collection
|
202
|
+
collectionOptions:
|
203
|
+
writeConcern:
|
204
|
+
w: majority
|
205
|
+
arguments:
|
206
|
+
documents:
|
207
|
+
- _id: 2
|
208
|
+
- _id: 3
|
209
|
+
session: session0
|
210
|
+
result:
|
211
|
+
insertedIds: {0: 2, 1: 3}
|
212
|
+
- name: commitTransaction
|
213
|
+
object: session0
|
214
|
+
|
215
|
+
expectations:
|
216
|
+
- command_started_event:
|
217
|
+
command:
|
218
|
+
insert: *collection_name
|
219
|
+
documents:
|
220
|
+
- _id: 1
|
221
|
+
ordered: true
|
222
|
+
readConcern:
|
223
|
+
lsid: session0
|
224
|
+
txnNumber:
|
225
|
+
$numberLong: "1"
|
226
|
+
startTransaction: true
|
227
|
+
autocommit: false
|
228
|
+
writeConcern:
|
229
|
+
command_name: insert
|
230
|
+
database_name: *database_name
|
231
|
+
- command_started_event:
|
232
|
+
command:
|
233
|
+
insert: *collection_name
|
234
|
+
documents:
|
235
|
+
- _id: 2
|
236
|
+
- _id: 3
|
237
|
+
ordered: true
|
238
|
+
lsid: session0
|
239
|
+
txnNumber:
|
240
|
+
$numberLong: "1"
|
241
|
+
startTransaction:
|
242
|
+
autocommit: false
|
243
|
+
writeConcern:
|
244
|
+
command_name: insert
|
245
|
+
database_name: *database_name
|
246
|
+
- command_started_event:
|
247
|
+
command:
|
248
|
+
commitTransaction: 1
|
249
|
+
lsid: session0
|
250
|
+
txnNumber:
|
251
|
+
$numberLong: "1"
|
252
|
+
startTransaction:
|
253
|
+
autocommit: false
|
254
|
+
writeConcern:
|
255
|
+
w: majority
|
256
|
+
command_name: commitTransaction
|
257
|
+
database_name: admin
|
258
|
+
|
259
|
+
outcome:
|
260
|
+
collection:
|
261
|
+
data:
|
262
|
+
- _id: 1
|
263
|
+
- _id: 2
|
264
|
+
- _id: 3
|
@@ -0,0 +1,125 @@
|
|
1
|
+
# Test snapshot isolation.
|
2
|
+
# This test doesn't check contents of command-started events.
|
3
|
+
database_name: &database_name "ruby-driver"
|
4
|
+
collection_name: &collection_name "transactions-tests"
|
5
|
+
|
6
|
+
data: []
|
7
|
+
|
8
|
+
tests:
|
9
|
+
- description: one transaction
|
10
|
+
|
11
|
+
operations:
|
12
|
+
- name: startTransaction
|
13
|
+
object: session0
|
14
|
+
- name: insertOne
|
15
|
+
object: collection
|
16
|
+
arguments:
|
17
|
+
session: session0
|
18
|
+
document:
|
19
|
+
_id: 1
|
20
|
+
result:
|
21
|
+
insertedId: 1
|
22
|
+
- name: find
|
23
|
+
object: collection
|
24
|
+
arguments:
|
25
|
+
session: session0
|
26
|
+
filter:
|
27
|
+
_id: 1
|
28
|
+
result:
|
29
|
+
- {_id: 1}
|
30
|
+
- name: find
|
31
|
+
object: collection
|
32
|
+
arguments:
|
33
|
+
session: session1
|
34
|
+
filter:
|
35
|
+
_id: 1
|
36
|
+
result: []
|
37
|
+
- name: find
|
38
|
+
object: collection
|
39
|
+
arguments:
|
40
|
+
filter:
|
41
|
+
_id: 1
|
42
|
+
result: []
|
43
|
+
- name: commitTransaction
|
44
|
+
object: session0
|
45
|
+
- name: find
|
46
|
+
object: collection
|
47
|
+
arguments:
|
48
|
+
session: session1
|
49
|
+
filter:
|
50
|
+
_id: 1
|
51
|
+
result:
|
52
|
+
- {_id: 1}
|
53
|
+
- name: find
|
54
|
+
object: collection
|
55
|
+
arguments:
|
56
|
+
filter:
|
57
|
+
_id: 1
|
58
|
+
result:
|
59
|
+
- {_id: 1}
|
60
|
+
|
61
|
+
outcome:
|
62
|
+
collection:
|
63
|
+
data:
|
64
|
+
- _id: 1
|
65
|
+
|
66
|
+
- description: two transactions
|
67
|
+
|
68
|
+
operations:
|
69
|
+
- name: startTransaction
|
70
|
+
object: session0
|
71
|
+
- name: startTransaction
|
72
|
+
object: session1
|
73
|
+
- name: insertOne
|
74
|
+
object: collection
|
75
|
+
arguments:
|
76
|
+
session: session0
|
77
|
+
document:
|
78
|
+
_id: 1
|
79
|
+
result:
|
80
|
+
insertedId: 1
|
81
|
+
- name: find
|
82
|
+
object: collection
|
83
|
+
arguments:
|
84
|
+
session: session0
|
85
|
+
filter:
|
86
|
+
_id: 1
|
87
|
+
result:
|
88
|
+
- {_id: 1}
|
89
|
+
- name: find
|
90
|
+
object: collection
|
91
|
+
arguments:
|
92
|
+
session: session1
|
93
|
+
filter:
|
94
|
+
_id: 1
|
95
|
+
result: []
|
96
|
+
- name: find
|
97
|
+
object: collection
|
98
|
+
arguments:
|
99
|
+
filter:
|
100
|
+
_id: 1
|
101
|
+
result: []
|
102
|
+
- name: commitTransaction
|
103
|
+
object: session0
|
104
|
+
# Snapshot isolation in session1, not read-committed.
|
105
|
+
- name: find
|
106
|
+
object: collection
|
107
|
+
arguments:
|
108
|
+
session: session1
|
109
|
+
filter:
|
110
|
+
_id: 1
|
111
|
+
result: []
|
112
|
+
- name: find
|
113
|
+
object: collection
|
114
|
+
arguments:
|
115
|
+
filter:
|
116
|
+
_id: 1
|
117
|
+
result:
|
118
|
+
- {_id: 1}
|
119
|
+
- name: commitTransaction
|
120
|
+
object: session1
|
121
|
+
|
122
|
+
outcome:
|
123
|
+
collection:
|
124
|
+
data:
|
125
|
+
- {_id: 1}
|
@@ -0,0 +1,340 @@
|
|
1
|
+
# This test doesn't check contents of command-started events.
|
2
|
+
database_name: &database_name "ruby-driver"
|
3
|
+
collection_name: &collection_name "transactions-tests"
|
4
|
+
|
5
|
+
data: []
|
6
|
+
|
7
|
+
tests:
|
8
|
+
- description: default readPreference
|
9
|
+
|
10
|
+
operations:
|
11
|
+
- name: startTransaction
|
12
|
+
object: session0
|
13
|
+
- name: insertMany
|
14
|
+
object: collection
|
15
|
+
arguments:
|
16
|
+
documents: &insertedDocs
|
17
|
+
- _id: 1
|
18
|
+
- _id: 2
|
19
|
+
- _id: 3
|
20
|
+
- _id: 4
|
21
|
+
session: session0
|
22
|
+
result:
|
23
|
+
insertedIds: {0: 1, 1: 2, 2: 3, 3: 4}
|
24
|
+
- name: aggregate
|
25
|
+
object: collection
|
26
|
+
collectionOptions:
|
27
|
+
# The driver overrides the collection's read pref with the
|
28
|
+
# transaction's so count runs with Primary and succeeds.
|
29
|
+
readPreference:
|
30
|
+
mode: Secondary
|
31
|
+
arguments:
|
32
|
+
session: session0
|
33
|
+
pipeline:
|
34
|
+
- $match:
|
35
|
+
_id: 1
|
36
|
+
- $count: count
|
37
|
+
result:
|
38
|
+
- count: 1
|
39
|
+
- name: find
|
40
|
+
object: collection
|
41
|
+
collectionOptions:
|
42
|
+
readPreference:
|
43
|
+
mode: Secondary
|
44
|
+
arguments:
|
45
|
+
session: session0
|
46
|
+
batchSize: 3
|
47
|
+
result: *insertedDocs
|
48
|
+
- name: aggregate
|
49
|
+
object: collection
|
50
|
+
collectionOptions:
|
51
|
+
readPreference:
|
52
|
+
mode: Secondary
|
53
|
+
arguments:
|
54
|
+
pipeline:
|
55
|
+
- $project:
|
56
|
+
_id: 1
|
57
|
+
batchSize: 3
|
58
|
+
session: session0
|
59
|
+
result: *insertedDocs
|
60
|
+
- name: commitTransaction
|
61
|
+
object: session0
|
62
|
+
|
63
|
+
outcome:
|
64
|
+
collection:
|
65
|
+
data: *insertedDocs
|
66
|
+
|
67
|
+
- description: primary readPreference
|
68
|
+
|
69
|
+
operations:
|
70
|
+
- name: startTransaction
|
71
|
+
object: session0
|
72
|
+
arguments:
|
73
|
+
options:
|
74
|
+
readPreference:
|
75
|
+
mode: Primary
|
76
|
+
- name: insertMany
|
77
|
+
object: collection
|
78
|
+
arguments:
|
79
|
+
documents: &insertedDocs
|
80
|
+
- _id: 1
|
81
|
+
- _id: 2
|
82
|
+
- _id: 3
|
83
|
+
- _id: 4
|
84
|
+
session: session0
|
85
|
+
result:
|
86
|
+
insertedIds: {0: 1, 1: 2, 2: 3, 3: 4}
|
87
|
+
- name: aggregate
|
88
|
+
object: collection
|
89
|
+
collectionOptions:
|
90
|
+
readPreference:
|
91
|
+
mode: Secondary
|
92
|
+
arguments:
|
93
|
+
session: session0
|
94
|
+
pipeline:
|
95
|
+
- $match:
|
96
|
+
_id: 1
|
97
|
+
- $count: count
|
98
|
+
result:
|
99
|
+
- count: 1
|
100
|
+
- name: find
|
101
|
+
object: collection
|
102
|
+
collectionOptions:
|
103
|
+
readPreference:
|
104
|
+
mode: Secondary
|
105
|
+
arguments:
|
106
|
+
session: session0
|
107
|
+
batchSize: 3
|
108
|
+
result: *insertedDocs
|
109
|
+
- name: aggregate
|
110
|
+
object: collection
|
111
|
+
collectionOptions:
|
112
|
+
readPreference:
|
113
|
+
mode: Secondary
|
114
|
+
arguments:
|
115
|
+
pipeline:
|
116
|
+
- $project:
|
117
|
+
_id: 1
|
118
|
+
batchSize: 3
|
119
|
+
session: session0
|
120
|
+
result: *insertedDocs
|
121
|
+
- name: commitTransaction
|
122
|
+
object: session0
|
123
|
+
|
124
|
+
outcome:
|
125
|
+
collection:
|
126
|
+
data: *insertedDocs
|
127
|
+
|
128
|
+
- description: secondary readPreference
|
129
|
+
|
130
|
+
operations:
|
131
|
+
- name: startTransaction
|
132
|
+
object: session0
|
133
|
+
arguments:
|
134
|
+
options:
|
135
|
+
readPreference:
|
136
|
+
mode: Secondary
|
137
|
+
- name: insertMany
|
138
|
+
object: collection
|
139
|
+
arguments:
|
140
|
+
documents: &insertedDocs
|
141
|
+
- _id: 1
|
142
|
+
- _id: 2
|
143
|
+
- _id: 3
|
144
|
+
- _id: 4
|
145
|
+
session: session0
|
146
|
+
result:
|
147
|
+
insertedIds: {0: 1, 1: 2, 2: 3, 3: 4}
|
148
|
+
- name: aggregate
|
149
|
+
object: collection
|
150
|
+
collectionOptions:
|
151
|
+
readPreference:
|
152
|
+
mode: Primary
|
153
|
+
arguments:
|
154
|
+
session: session0
|
155
|
+
pipeline:
|
156
|
+
- $match:
|
157
|
+
_id: 1
|
158
|
+
- $count: count
|
159
|
+
result:
|
160
|
+
errorContains: read preference in a transaction must be primary
|
161
|
+
- name: find
|
162
|
+
object: collection
|
163
|
+
collectionOptions:
|
164
|
+
readPreference:
|
165
|
+
mode: Primary
|
166
|
+
arguments:
|
167
|
+
session: session0
|
168
|
+
batchSize: 3
|
169
|
+
result:
|
170
|
+
errorContains: read preference in a transaction must be primary
|
171
|
+
- name: aggregate
|
172
|
+
object: collection
|
173
|
+
collectionOptions:
|
174
|
+
readPreference:
|
175
|
+
mode: Primary
|
176
|
+
arguments:
|
177
|
+
pipeline:
|
178
|
+
- $project:
|
179
|
+
_id: 1
|
180
|
+
batchSize: 3
|
181
|
+
session: session0
|
182
|
+
result:
|
183
|
+
errorContains: read preference in a transaction must be primary
|
184
|
+
- name: abortTransaction
|
185
|
+
object: session0
|
186
|
+
|
187
|
+
outcome:
|
188
|
+
collection:
|
189
|
+
data: []
|
190
|
+
|
191
|
+
- description: primaryPreferred readPreference
|
192
|
+
|
193
|
+
operations:
|
194
|
+
- name: startTransaction
|
195
|
+
object: session0
|
196
|
+
arguments:
|
197
|
+
options:
|
198
|
+
readPreference:
|
199
|
+
mode: PrimaryPreferred
|
200
|
+
- name: insertMany
|
201
|
+
object: collection
|
202
|
+
arguments:
|
203
|
+
documents: &insertedDocs
|
204
|
+
- _id: 1
|
205
|
+
- _id: 2
|
206
|
+
- _id: 3
|
207
|
+
- _id: 4
|
208
|
+
session: session0
|
209
|
+
result:
|
210
|
+
insertedIds: {0: 1, 1: 2, 2: 3, 3: 4}
|
211
|
+
- name: aggregate
|
212
|
+
object: collection
|
213
|
+
collectionOptions:
|
214
|
+
readPreference:
|
215
|
+
mode: Primary
|
216
|
+
arguments:
|
217
|
+
session: session0
|
218
|
+
pipeline:
|
219
|
+
- $match:
|
220
|
+
_id: 1
|
221
|
+
- $count: count
|
222
|
+
result:
|
223
|
+
errorContains: read preference in a transaction must be primary
|
224
|
+
- name: find
|
225
|
+
object: collection
|
226
|
+
collectionOptions:
|
227
|
+
readPreference:
|
228
|
+
mode: Primary
|
229
|
+
arguments:
|
230
|
+
session: session0
|
231
|
+
batchSize: 3
|
232
|
+
result:
|
233
|
+
errorContains: read preference in a transaction must be primary
|
234
|
+
- name: aggregate
|
235
|
+
object: collection
|
236
|
+
collectionOptions:
|
237
|
+
readPreference:
|
238
|
+
mode: Primary
|
239
|
+
arguments:
|
240
|
+
pipeline:
|
241
|
+
- $project:
|
242
|
+
_id: 1
|
243
|
+
batchSize: 3
|
244
|
+
session: session0
|
245
|
+
result:
|
246
|
+
errorContains: read preference in a transaction must be primary
|
247
|
+
- name: abortTransaction
|
248
|
+
object: session0
|
249
|
+
|
250
|
+
outcome:
|
251
|
+
collection:
|
252
|
+
data: []
|
253
|
+
|
254
|
+
- description: nearest readPreference
|
255
|
+
|
256
|
+
operations:
|
257
|
+
- name: startTransaction
|
258
|
+
object: session0
|
259
|
+
arguments:
|
260
|
+
options:
|
261
|
+
readPreference:
|
262
|
+
mode: Nearest
|
263
|
+
- name: insertMany
|
264
|
+
object: collection
|
265
|
+
arguments:
|
266
|
+
documents: &insertedDocs
|
267
|
+
- _id: 1
|
268
|
+
- _id: 2
|
269
|
+
- _id: 3
|
270
|
+
- _id: 4
|
271
|
+
session: session0
|
272
|
+
result:
|
273
|
+
insertedIds: {0: 1, 1: 2, 2: 3, 3: 4}
|
274
|
+
- name: aggregate
|
275
|
+
object: collection
|
276
|
+
collectionOptions:
|
277
|
+
readPreference:
|
278
|
+
mode: Primary
|
279
|
+
arguments:
|
280
|
+
session: session0
|
281
|
+
pipeline:
|
282
|
+
- $match:
|
283
|
+
_id: 1
|
284
|
+
- $count: count
|
285
|
+
result:
|
286
|
+
errorContains: read preference in a transaction must be primary
|
287
|
+
- name: find
|
288
|
+
object: collection
|
289
|
+
collectionOptions:
|
290
|
+
readPreference:
|
291
|
+
mode: Primary
|
292
|
+
arguments:
|
293
|
+
session: session0
|
294
|
+
batchSize: 3
|
295
|
+
result:
|
296
|
+
errorContains: read preference in a transaction must be primary
|
297
|
+
- name: aggregate
|
298
|
+
object: collection
|
299
|
+
collectionOptions:
|
300
|
+
readPreference:
|
301
|
+
mode: Primary
|
302
|
+
arguments:
|
303
|
+
pipeline:
|
304
|
+
- $project:
|
305
|
+
_id: 1
|
306
|
+
batchSize: 3
|
307
|
+
session: session0
|
308
|
+
result:
|
309
|
+
errorContains: read preference in a transaction must be primary
|
310
|
+
- name: abortTransaction
|
311
|
+
object: session0
|
312
|
+
|
313
|
+
outcome:
|
314
|
+
collection:
|
315
|
+
data: []
|
316
|
+
|
317
|
+
- description: secondary write only
|
318
|
+
|
319
|
+
operations:
|
320
|
+
- name: startTransaction
|
321
|
+
object: session0
|
322
|
+
arguments:
|
323
|
+
options:
|
324
|
+
readPreference:
|
325
|
+
mode: Secondary
|
326
|
+
- name: insertOne
|
327
|
+
object: collection
|
328
|
+
arguments:
|
329
|
+
session: session0
|
330
|
+
document:
|
331
|
+
_id: 1
|
332
|
+
result:
|
333
|
+
insertedId: 1
|
334
|
+
- name: commitTransaction
|
335
|
+
object: session0
|
336
|
+
|
337
|
+
outcome:
|
338
|
+
collection:
|
339
|
+
data:
|
340
|
+
- _id: 1
|