diff --git a/lib/mongo/client.rb b/lib/mongo/client.rb index 13465ee06e..e168c95f4d 100644 --- a/lib/mongo/client.rb +++ b/lib/mongo/client.rb @@ -589,10 +589,11 @@ def list_mongo_databases(filter = {}, opts = {}) # @example Start a session. # client.start_session(causal_consistency: true) # - # @param [ Hash ] options The session options. + # @param [ Hash ] options The session options. Accepts the options + # that Session#initialize accepts. # - # @note A Session cannot be used by multiple threads at once; session objects are not - # thread-safe. + # @note A Session cannot be used by multiple threads at once; session + # objects are not thread-safe. # # @return [ Session ] The session. # diff --git a/lib/mongo/database.rb b/lib/mongo/database.rb index 90ddd88df4..3809b83c68 100644 --- a/lib/mongo/database.rb +++ b/lib/mongo/database.rb @@ -150,6 +150,7 @@ def collections # @param [ Hash ] opts The command options. # # @option opts :read [ Hash ] The read preference for this command. + # @option opts :session [ Session ] The session to use for this command. # # @return [ Hash ] The result of the command execution. def command(operation, opts = {}) diff --git a/lib/mongo/session.rb b/lib/mongo/session.rb index 87ce387c17..6d08e649d6 100644 --- a/lib/mongo/session.rb +++ b/lib/mongo/session.rb @@ -114,6 +114,13 @@ class Session # @param [ Client ] client The client through which this session is created. # @param [ Hash ] options The options for this session. # + # @option options [ true|false ] :causal_consistency Whether to enable + # causal consistency for this session. + # @option options [ Hash ] :default_transaction_options Options to pass + # to start_transaction by default, can contain any of the options that + # start_transaction accepts. + # @option options [ true|false ] :implicit For internal driver use only - + # specifies whether the session is implicit. # @option options [ Hash ] :read_preference The read preference options hash, # with the following optional keys: # - *:mode* -- the read preference as a string or symbol; valid values are diff --git a/spec/support/transactions.rb b/spec/support/transactions.rb index 9e129abbda..6b7dec77f4 100644 --- a/spec/support/transactions.rb +++ b/spec/support/transactions.rb @@ -257,9 +257,7 @@ def setup_test coll = support_client[@spec.collection_name] coll.database.drop coll.with(write: { w: :majority }).drop - support_client.command( - { create: @spec.collection_name }, - { write_concern: { w: :majority } }) + support_client.command(create: @spec.collection_name) coll.with(write: { w: :majority }).insert_many(@data) unless @data.empty? admin_support_client.command(@fail_point) if @fail_point