ArgumentError when using insert_many in transaction

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Ruby Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      The following code

      client.with_session(default_timeout_ms: 10_000) do |session|
        session.with_transaction do
          collection.insert_many(documents)
        end
      end 
      

      fails with

      ArgumentError:
        Cannot override timeout_ms inside with_transaction block 
      

      because BulkWrite#executed calculates operation_timeout_ms based on the client's timeout:

      https://github.com/mongodb/mongo-ruby-driver/blob/17f8c4ac403c516c66103000cff0590d164819a3/lib/mongo/bulk_write.rb#L70

            Assignee:
            Unassigned
            Reporter:
            Dmitry Rybakov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: