def insert_one(document, opts = {})
      client.send(:with_session, opts) do |session|
        write_with_retry(session, write_concern) do |server, txn_num|
          Operation::Insert.new(
              :documents => [ document ],
              :db_name => database.name,
              :coll_name => name,
              :write_concern => write_concern,
              :bypass_document_validation => !!opts[:bypass_document_validation],
              :options => opts,
              :id_generator => client.options[:id_generator],
              :session => session,
              :txn_num => txn_num
           ).execute(server)
        end
      end
    end
def insert_one(document, opts = {})
      client.send(:with_session, opts) do |session|
        write_with_retry(session, write_concern) do |server, txn_num|
          Operation::Insert.new(
              :documents => [ document ],
              :db_name => database.name,
              :coll_name => name,
              :write_concern => write_concern,
              :bypass_document_validation => !!opts[:bypass_document_validation],
              :options => opts,
              :id_generator => client.options[:id_generator],
              :session => session,
              :txn_num => txn_num
           ).execute(server)
        end
      end
    end
Insert a single document into the collection.

 @example Insert a document into the collection.
   collection.insert_one({ name: 'test' })

 @param [ Hash ] document The document to insert.
 @param [ Hash ] opts The insert options.

 @option opts [ Session ] :session The session to use for the operation.

 @return [ Result ] The database response wrapper.

 @since 2.0.0