class Mongo::Operation::Insert::Result
Defines custom behavior of results for an insert.
According to the CRUD spec, reporting the inserted ids is optional. It can be added to this class later, if needed.
@since 2.0.0 @api semiprivate
Attributes
Get the ids of the inserted documents.
@since 2.0.0 @api public
Public Class Methods
Source
# File lib/mongo/operation/insert/result.rb, line 47 def initialize(replies, connection_description, ids) super(replies, connection_description) @inserted_ids = ids end
Initialize a new result.
@example Instantiate the result.
Result.new(replies, inserted_ids)
@param [ Array<Protocol::Message> | nil ] replies The wire protocol replies, if any. @param [ Server::Description
] connection_description
Server description of the server that performed the operation that this result is for.
@param [ Array<Object> ] ids The ids of the inserted documents.
@since 2.0.0 @api private
Calls superclass method
Mongo::Operation::Result::new
Public Instance Methods
Source
# File lib/mongo/operation/insert/result.rb, line 66 def bulk_result BulkResult.new(@replies, connection_description, @inserted_ids) end
@api public
Source
# File lib/mongo/operation/insert/result.rb, line 61 def inserted_id inserted_ids.first end
Gets the id of the document inserted.
@example Get id of the document inserted.
result.inserted_id
@return [ Object ] The id of the document inserted.
@since 2.0.0 @api public