This is an automated email from the ASF dual-hosted git repository.
wohali pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-documentation.git
The following commit(s) were added to refs/heads/main by this push:
new 7fc1ff5 Improve mango docs (#639)
7fc1ff5 is described below
commit 7fc1ff5074d7363e6c067daf54d3ca5137b504ca
Author: Joan Touzet <[email protected]>
AuthorDate: Tue Mar 30 17:02:59 2021 +0000
Improve mango docs (#639)
* Improve use_index documentation, closes #350
* Clarify condition operators, closes #380
* Clarify comparison ops, closes #381
* Document conflicts option for mango, closes #391
* Update src/api/database/find.rst
Co-authored-by: Bessenyei Balázs Donát <[email protected]>
Co-authored-by: Bessenyei Balázs Donát <[email protected]>
---
src/api/database/find.rst | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/src/api/database/find.rst b/src/api/database/find.rst
index 09ae5c4..2d2dc19 100644
--- a/src/api/database/find.rst
+++ b/src/api/database/find.rst
@@ -44,6 +44,9 @@
:<json string|array use_index: Instruct a query to use a specific index.
Specified either as ``"<design_document>"`` or
``["<design_document>", "<index_name>"]``. *Optional*
+ :<json boolean conflicts: Include conflicted documents if ``true``.
+ Intended use is to easily find conflicted documents, without an
+ index or view. Default is ``false``. *Optional*
:<json number r: Read quorum needed for the result. This defaults to 1, in
which case the document found in the index is returned. If set to a
higher value, each document is read from at least that many replicas
@@ -648,10 +651,18 @@ Condition operators are specific to a field, and are used
to evaluate the value
stored in that field. For instance, the basic `$eq` operator matches when the
specified field contains a value that is equal to the supplied argument.
-The basic equality and inequality operators common to most programming
languages
-are supported. In addition, some 'meta' condition operators are available. Some
-condition operators accept any valid JSON content as the argument.
-Other condition operators require the argument to be in a specific JSON format.
+.. note::
+ For a condition operator to function correctly, the field **must exist**
+ in the document for the selector to match. As an example, ``$ne`` means
+ the specified field must exist, and is not equal to the value of the
+ argument.
+
+The basic equality and inequality operators common to most programming
+languages are supported. Strict type matching is used.
+
+In addition, some 'meta' condition operators are available. Some condition
+operators accept any valid JSON content as the argument. Other condition
+operators require the argument to be in a specific JSON format.
+---------------+-------------+------------+-----------------------------------+
| Operator type | Operator | Argument | Purpose
|
@@ -1141,6 +1152,14 @@ but including it makes the intent of the selector
clearer and will make
it easier to take advantage of future improvements to query planning
(e.g. automatic selection of partial indexes).
+.. note::
+ An index with fields is only used, when the selector includes
+ all of the fields indexed. For instance, if an index contains ``["a".
"b"]``
+ but the selector only requires field ``["a"]`` to exist in the matching
+ documents, the index would not be valid for the query. All indexes,
+ however, can be treated as if they include the special fields ``_id`` and
+ ``_rev``. They **never** need to be specified in the query selector.
+
.. _api/db/find/index-get:
.. http:get:: /{db}/_index