You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2017/03/08 01:40:30 UTC
[2/3] documentation commit: updated refs/heads/master to d57d218
Add documentation for the `$allMatch` selector
Project: http://git-wip-us.apache.org/repos/asf/couchdb-documentation/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-documentation/commit/8ab379f3
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-documentation/tree/8ab379f3
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-documentation/diff/8ab379f3
Branch: refs/heads/master
Commit: 8ab379f333ff43505ca74131fddd82397478bbf3
Parents: 54e5a46
Author: Lucas Satabin <lu...@gnieh.org>
Authored: Sat Feb 11 17:11:53 2017 +0100
Committer: Nick Vatamaniuc <va...@apache.org>
Committed: Tue Mar 7 20:35:28 2017 -0500
----------------------------------------------------------------------
src/api/database/find.rst | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-documentation/blob/8ab379f3/src/api/database/find.rst
----------------------------------------------------------------------
diff --git a/src/api/database/find.rst b/src/api/database/find.rst
index 428c5b7..53ab24c 100644
--- a/src/api/database/find.rst
+++ b/src/api/database/find.rst
@@ -319,8 +319,9 @@ Combination Operators
---------------------
Combination operators are used to combine selectors. In addition to the common
-boolean operators found in most programming languages, there are two combination
-operators (``$all`` and ``$elemMatch``) that help you work with JSON arrays.
+boolean operators found in most programming languages, there are three
+combination operators (``$all``, ``$elemMatch``, and ``$allMatch``) that help
+you work with JSON arrays.
A combination operator takes a single argument. The argument is either another
selector, or an array of selectors.
@@ -347,6 +348,10 @@ The list of combination operators:
| | | array field with at least one element that |
| | | matches all the specified query criteria. |
+----------------+----------+--------------------------------------------------+
+| ``$allMatch`` | Selector | Matches and returns all documents that contain an|
+| | | array field with all its elements matching all |
+| | | the specified query criteria. |
++----------------+----------+--------------------------------------------------+
.. _find/and:
@@ -469,6 +474,25 @@ Below is an example used with used with the primary index (``_all_docs``):
}
}
+.. _find/allmatch:
+
+**The ``$allMatch`` operator**
+
+The ``$allMatch`` operator matches and returns all documents that contain an
+array field with all its elements matching the supplied query criteria. Below
+is an example used with the primary index (``_all_docs``):
+
+ .. code-block:: javascript
+
+ {
+ "_id": { "$gt": null },
+ "genre": {
+ "$allMatch": {
+ "$eq": "Horror"
+ }
+ }
+ }
+
.. _find/condition-operators:
Condition Operators