def with(options = {})
      session = dup
      session.options.update(options)
      if block_given?
        yield(session)
      else
        session
      end
    end
def with(options = {})
      session = dup
      session.options.update(options)
      if block_given?
        yield(session)
      else
        session
      end
    end
Create a new session with +options+ reusing existing connections.

 @example Change safe mode
   session.with(write: { w: 2 })[:people].insert(name: "Joe")

 @example Change safe mode with block
   session.with(write: { w: 2 }) do |session|
     session[:people].insert(name: "Joe")
   end

 @example Temporarily change database
   session.with(database: "admin") do |admin|
     admin.command ismaster: 1
   end

 @example Copy between databases
   session.use "moped"
   session.with(database: "backup") do |backup|
     session[:people].each do |person|
       backup[:people].insert person
     end
   end

 @param [ Hash ] options The session options.

 @return [ Session, Object ] The new session, or the value returned
   by the block if provided.

 @since 1.0.0

 @yieldparam [ Session ] session The new session.