lib/mongo/operation/insert/legacy.rb in mongo-2.12.4 vs lib/mongo/operation/insert/legacy.rb in mongo-2.13.0.beta1

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (C) 2015-2019 MongoDB, Inc. +# Copyright (C) 2015-2020 MongoDB Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # @@ -28,20 +28,24 @@ include Executable include Idable private - def get_result(server, client, options = {}) + def get_result(connection, client, options = {}) # This is a Mongo::Operation::Insert::Result - Result.new(dispatch_message(server, client), @ids) + Result.new(*dispatch_message(connection, client), @ids) end def selector send(IDENTIFIER).first end - def message(server) - opts = !!options[:continue_on_error] ? { :flags => [:continue_on_error] } : {} + def message(connection) + opts = if options(connection)[:continue_on_error] + { :flags => [:continue_on_error] } + else + {} + end Protocol::Insert.new(db_name, coll_name, documents, opts) end def gle wc = write_concern || WriteConcern.get(WriteConcern::DEFAULT)