NAME¶
MongoDB::WriteResult - MongoDB write result document
VERSION¶
version v0.705.0.0
SYNOPSIS¶
# returned directly
my $result = $bulk->execute;
# from a WriteError or WriteConcernError
my $result = $error->result;
DESCRIPTION¶
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".
ATTRIBUTES¶
nInserted¶
Number of documents inserted
nUpserted¶
Number of documents upserted
nMatched¶
Number of documents matched for an update or replace operation.
nRemoved¶
Number of documents removed
nModified¶
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".
upserted¶
An array reference containing information about upserted documetns (if any).
Each document will have the following fields:
- •
- index X 0-based index indicating which operation failed
- •
- _id X the object ID of the upserted document
writeErrors¶
An array reference containing write errors (if any). Each error document will
have the following fields:
- •
- index X 0-based index indicating which operation failed
- •
- code X numeric error code
- •
- errmsg X textual error string
- •
- op X a representation of the actual operation sent to the server
writeConcernErrors¶
An array reference containing write concern errors (if any). Each error document
will have the following fields:
- •
- index X 0-based index indicating which operation failed
- •
- code X numeric error code
op_count¶
The number of operations sent to the database.
batch_count¶
The number of database commands issued to the server. This will be less than the
"op_count" if multiple operations were grouped together.
METHODS¶
count_writeErrors¶
Returns the number of write errors
count_writeConcernErrors¶
Returns the number of write errors
last_errmsg¶
Returns the last "errmsg" field from either the list of
"writeErrors" or "writeConcernErrors" or the empty string
if there are no errors.
AUTHORS¶
- •
- David Golden <david.golden@mongodb.org>
- •
- Mike Friedman <friedo@mongodb.com>
- •
- Kristina Chodorow <kristina@mongodb.org>
- •
- Florian Ragwitz <rafl@debian.org>
COPYRIGHT AND LICENSE¶
This software is Copyright (c) 2014 by MongoDB, Inc..
This is free software, licensed under:
The Apache License, Version 2.0, January 2004