1MongoDB::BulkWriteView(U3s)er Contributed Perl DocumentatMioonngoDB::BulkWriteView(3)
2
3
4

NAME

6       MongoDB::BulkWriteView - Bulk write operations against a query document
7

VERSION

9       version v2.2.2
10

SYNOPSIS

12           my $bulk = $collection->initialize_ordered_bulk_op;
13
14           # Update one document matching the selector
15           bulk->find( { a => 1 } )->update_one( { '$inc' => { x => 1 } } );
16
17           # Update all documents matching the selector
18           bulk->find( { a => 2 } )->update_many( { '$inc' => { x => 2 } } );
19
20           # Update all documents matching the selector, with respect to a collation
21           bulk->find( { a => { '$gte' => 'F' } )->collation($collation)
22                 ->update_many( { '$inc' => { x => 2 } } );
23
24           # Update all documents
25           bulk->find( {} )->update_many( { '$inc' => { x => 2 } } );
26
27           # Replace entire document (update with whole doc replace)
28           bulk->find( { a => 3 } )->replace_one( { x => 3 } );
29
30           # Update one document matching the selector or upsert
31           bulk->find( { a => 1 } )->upsert()->update_one( { '$inc' => { x => 1 } } );
32
33           # Update all documents matching the selector or upsert
34           bulk->find( { a => 2 } )->upsert()->update_many( { '$inc' => { x => 2 } } );
35
36           # Replaces a single document matching the selector or upsert
37           bulk->find( { a => 3 } )->upsert()->replace_one( { x => 3 } );
38
39           # Remove a single document matching the selector
40           bulk->find( { a => 4 } )->delete_one();
41
42           # Remove all documents matching the selector
43           bulk->find( { a => 5 } )->delete_many();
44
45           # Update any arrays with the matching filter
46           bulk->find( {} )->arrayFilters([ { 'i.b' => 1 } ])->update_many( { '$set' => { 'y.$[i].b' => 2 } } );
47
48           # Remove all documents matching the selector, with respect to a collation
49           bulk->find( { a => { '$gte' => 'F' } )->collation($collation)->delete_many();
50
51           # Remove all documents
52           bulk->find( {} )->delete_many();
53

DESCRIPTION

55       This class provides means to specify write operations constrained by a
56       query document.
57
58       To instantiate a "MongoDB::BulkWriteView", use the find method from
59       MongoDB::BulkWrite.
60
61       Except for "arrayFilters", "collation" and "upsert", all methods have
62       an empty return on success; an exception will be thrown on error.
63

METHODS

65   arrayFilters
66           $bulk->arrayFilters( $array_filters )->update_many( $modification );
67
68       Returns a new "MongoDB::BulkWriteView" object, where the specified
69       arrayFilter will be used to determine which array elements to modify
70       for an update operation on an array field.
71
72   collation
73           $bulk->collation( $collation )->delete_one;
74
75       Returns a new "MongoDB::BulkWriteView" object, where the specified
76       collation will be used to determine which documents match the query
77       document.  A collation can be specified for any deletion, replacement,
78       or update.
79
80   delete_many
81           $bulk->delete_many;
82
83       Removes all documents matching the query document.
84
85   delete_one
86           $bulk->delete_one;
87
88       Removes a single document matching the query document.
89
90   replace_one
91           $bulk->replace_one( $doc );
92
93       Replaces the document matching the query document.  The document to
94       replace must not have any keys that begin with a dollar sign, "$".
95
96   update_many
97           $bulk->update_many( $modification );
98
99       Updates all documents  matching the query document.  The modification
100       document must have all its keys begin with a dollar sign, "$".
101
102   update_one
103           $bulk->update_one( $modification );
104
105       Updates a single document matching the query document.  The
106       modification document must have all its keys begin with a dollar sign,
107       "$".
108
109   upsert
110           $bulk->upsert->replace_one( $doc );
111
112       Returns a new "MongoDB::BulkWriteView" object that will treat every
113       update, update_one or replace_one operation as an upsert operation.
114

AUTHORS

116       •   David Golden <david@mongodb.com>
117
118       •   Rassi <rassi@mongodb.com>
119
120       •   Mike Friedman <friedo@friedo.com>
121
122       •   Kristina Chodorow <k.chodorow@gmail.com>
123
124       •   Florian Ragwitz <rafl@debian.org>
125
127       This software is Copyright (c) 2020 by MongoDB, Inc.
128
129       This is free software, licensed under:
130
131         The Apache License, Version 2.0, January 2004
132
133
134
135perl v5.38.0                      2023-07-20         MongoDB::BulkWriteView(3)
Impressum