1MongoDB::BulkWriteResulUts(e3r)Contributed Perl DocumentMaotnigoonDB::BulkWriteResult(3)
2
3
4

NAME

6       MongoDB::BulkWriteResult - MongoDB bulk write result document
7

VERSION

9       version v2.2.2
10

SYNOPSIS

12           # returned directly
13           my $result = $bulk->execute;
14
15           # from a WriteError or WriteConcernError
16           my $result = $error->result;
17
18           if ( $result->acknowledged ) {
19               ...
20           }
21

DESCRIPTION

23       This class encapsulates the results from a bulk write operation. It may
24       be returned directly from "execute" or it may be in the "result"
25       attribute of a "MongoDB::DatabaseError" subclass like
26       "MongoDB::WriteError" or "MongoDB::WriteConcernError".
27

ATTRIBUTES

29   inserted_count
30       Number of documents inserted
31
32   upserted_count
33       Number of documents upserted
34
35   matched_count
36       Number of documents matched for an update or replace operation.
37
38   deleted_count
39       Number of documents removed
40
41   modified_count
42       Number of documents actually modified by an update operation. This is
43       not necessarily the same as "matched_count" if the document was not
44       actually modified as a result of the update.
45
46       This field is not available from legacy servers before version 2.6.  If
47       results are seen from a legacy server (or from a mongos proxying for a
48       legacy server) this attribute will be "undef".
49
50       You can call "has_modified_count" to find out if this attribute is
51       defined or not.
52
53   upserted
54       An array reference containing information about upserted documents (if
55       any).  Each document will have the following fields:
56
57       •   index — 0-based index indicating which operation failed
58
59       •   _id — the object ID of the upserted document
60
61   upserted_ids
62       A hash reference built lazily from "upserted" mapping indexes to object
63       IDs.
64
65   inserted
66       An array reference containing information about inserted documents (if
67       any).  Documents are just as in "upserted".
68
69   inserted_ids
70       A hash reference built lazily from "inserted" mapping indexes to object
71       IDs.
72
73   write_errors
74       An array reference containing write errors (if any).  Each error
75       document will have the following fields:
76
77       •   index — 0-based index indicating which operation failed
78
79       •   code — numeric error code
80
81       •   errmsg — textual error string
82
83       •   op — a representation of the actual operation sent to the server
84
85   write_concern_errors
86       An array reference containing write concern errors (if any).  Each
87       error document will have the following fields:
88
89       •   index — 0-based index indicating which operation failed
90
91       •   code — numeric error code
92
93   op_count
94       The number of operations sent to the database.
95
96   batch_count
97       The number of database commands issued to the server.  This will be
98       less than the "op_count" if multiple operations were grouped together.
99

METHODS

101   assert
102       Throws an error if write errors or write concern errors occurred.
103
104   assert_no_write_error
105       Throws a MongoDB::WriteError if "count_write_errors" is non-zero;
106       otherwise returns 1.
107
108   assert_no_write_concern_error
109       Throws a MongoDB::WriteConcernError if "count_write_concern_errors" is
110       non-zero; otherwise returns 1.
111
112   count_write_errors
113       Returns the number of write errors
114
115   count_write_concern_errors
116       Returns the number of write errors
117
118   last_code
119       Returns the last "code" field from either the list of "write_errors" or
120       "write_concern_errors" or 0 if there are no errors.
121
122   last_errmsg
123       Returns the last "errmsg" field from either the list of "write_errors"
124       or "write_concern_errors" or the empty string if there are no errors.
125
126   last_wtimeout
127       True if a write concern timed out or false otherwise.
128

AUTHORS

130       •   David Golden <david@mongodb.com>
131
132       •   Rassi <rassi@mongodb.com>
133
134       •   Mike Friedman <friedo@friedo.com>
135
136       •   Kristina Chodorow <k.chodorow@gmail.com>
137
138       •   Florian Ragwitz <rafl@debian.org>
139
141       This software is Copyright (c) 2020 by MongoDB, Inc.
142
143       This is free software, licensed under:
144
145         The Apache License, Version 2.0, January 2004
146
147
148
149perl v5.34.0                      2021-07-22       MongoDB::BulkWriteResult(3)
Impressum