-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Bulk.find.arrayFilters.txt
48 lines (34 loc) · 1.27 KB
/
Bulk.find.arrayFilters.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
========================
Bulk.find.arrayFilters()
========================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Description
-----------
.. method:: Bulk.find.arrayFilters(<array of filter documents>)
Determines which array elements to modify for an update operation on
an array field:
.. code-block:: javascript
Bulk.find(<query>).arrayFilters([ <filter1>, ... ]).updateOne(<update>);
Bulk.find(<query>).arrayFilters([ <filter1>, ... ]).update(<update>);
.. include:: /includes/extracts/arrayFilters-details.rst
Append to :method:`Bulk.find()` method to specify the array filters
for the :method:`~Bulk.find.updateOne()` and
:method:`~Bulk.find.update()` operations.
Example
-------
.. code-block:: javascript
var bulk = db.coll.initializeUnorderedBulkOp();
bulk.find({}).arrayFilters( [ { "elem.grade": { $gt: 85 } } ] ).updateOne( { $set: { "grades.$[elem].mean" : 70 } } );
bulk.execute();
.. seealso::
- :method:`db.collection.initializeUnorderedBulkOp()`
- :method:`db.collection.initializeOrderedBulkOp()`
- :method:`Bulk.find.update()`
- :method:`Bulk.find.updateOne()`
- :method:`Bulk.execute()`
- :ref:`All Bulk Methods <bulk-methods>`