Skip to content
This repository was archived by the owner on Oct 17, 2022. It is now read-only.

Commit 7fc1ff5

Browse files
wohalibessbd
andauthored
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]>
1 parent c80afbb commit 7fc1ff5

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

src/api/database/find.rst

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
:<json string|array use_index: Instruct a query to use a specific index.
4545
Specified either as ``"<design_document>"`` or
4646
``["<design_document>", "<index_name>"]``. *Optional*
47+
:<json boolean conflicts: Include conflicted documents if ``true``.
48+
Intended use is to easily find conflicted documents, without an
49+
index or view. Default is ``false``. *Optional*
4750
:<json number r: Read quorum needed for the result. This defaults to 1, in
4851
which case the document found in the index is returned. If set to a
4952
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
648651
stored in that field. For instance, the basic `$eq` operator matches when the
649652
specified field contains a value that is equal to the supplied argument.
650653

651-
The basic equality and inequality operators common to most programming languages
652-
are supported. In addition, some 'meta' condition operators are available. Some
653-
condition operators accept any valid JSON content as the argument.
654-
Other condition operators require the argument to be in a specific JSON format.
654+
.. note::
655+
For a condition operator to function correctly, the field **must exist**
656+
in the document for the selector to match. As an example, ``$ne`` means
657+
the specified field must exist, and is not equal to the value of the
658+
argument.
659+
660+
The basic equality and inequality operators common to most programming
661+
languages are supported. Strict type matching is used.
662+
663+
In addition, some 'meta' condition operators are available. Some condition
664+
operators accept any valid JSON content as the argument. Other condition
665+
operators require the argument to be in a specific JSON format.
655666

656667
+---------------+-------------+------------+-----------------------------------+
657668
| Operator type | Operator | Argument | Purpose |
@@ -1141,6 +1152,14 @@ but including it makes the intent of the selector clearer and will make
11411152
it easier to take advantage of future improvements to query planning
11421153
(e.g. automatic selection of partial indexes).
11431154

1155+
.. note::
1156+
An index with fields is only used, when the selector includes
1157+
all of the fields indexed. For instance, if an index contains ``["a". "b"]``
1158+
but the selector only requires field ``["a"]`` to exist in the matching
1159+
documents, the index would not be valid for the query. All indexes,
1160+
however, can be treated as if they include the special fields ``_id`` and
1161+
``_rev``. They **never** need to be specified in the query selector.
1162+
11441163
.. _api/db/find/index-get:
11451164

11461165
.. http:get:: /{db}/_index

0 commit comments

Comments
 (0)