MongoDB::WriteResult - MongoDB write result document
version v0.708.4.0
# returned directly my $result = $bulk->execute; # from a WriteError or WriteConcernError my $result = $error->result;
This class encapsulates the results from a bulk write operation. It may be returned directly from execute or it may be in the result attribute of a MongoDB::DatabaseError subclass like MongoDB::WriteError or MongoDB::WriteConcernError.
execute
result
MongoDB::DatabaseError
MongoDB::WriteError
MongoDB::WriteConcernError
Number of documents inserted
Number of documents upserted
Number of documents matched for an update or replace operation.
Number of documents removed
Number of documents actually modified by an update operation. This is not necessarily the same as "nMatched" if the document was not actually modified as a result of the update.
This field is not available from legacy servers before version 2.6. If results are seen from a legacy server (or from a mongos proxying for a legacy server) this attribute will be undef.
undef
An array reference containing information about upserted documetns (if any). Each document will have the following fields:
index — 0-based index indicating which operation failed
_id — the object ID of the upserted document
An array reference containing write errors (if any). Each error document will have the following fields:
code — numeric error code
errmsg — textual error string
op — a representation of the actual operation sent to the server
An array reference containing write concern errors (if any). Each error document will have the following fields:
The number of operations sent to the database.
The number of database commands issued to the server. This will be less than the op_count if multiple operations were grouped together.
op_count
Returns the number of write errors
Returns the last errmsg field from either the list of writeErrors or writeConcernErrors or the empty string if there are no errors.
errmsg
writeErrors
writeConcernErrors
David Golden <david@mongodb.com>
Mike Friedman <friedo@friedo.com>
Kristina Chodorow <k.chodorow@gmail.com>
Florian Ragwitz <rafl@debian.org>
This software is Copyright (c) 2015 by MongoDB, Inc..
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
To install MongoDB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MongoDB
CPAN shell
perl -MCPAN -e shell install MongoDB
For more information on module installation, please visit the detailed CPAN module installation guide.