Skip to content

Commit adf0aeb

Browse files
author
Sam Kleinman
committed
regorganize and index the operators page
1 parent 3249f59 commit adf0aeb

File tree

1 file changed

+71
-20
lines changed

1 file changed

+71
-20
lines changed

source/reference/operators.txt

Lines changed: 71 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@ Operator Reference
33
==================
44

55
.. default-domain:: mongodb
6-
.. highlight:: javascript
76

87
This document contains a reference to all :term:`operators <operator>`
98
used with MongoDB in version |version|.
109

10+
.. index:: query selectors
1111
.. _query-selectors:
1212

1313
Query Selectors
1414
---------------
1515

16+
.. index:: query selectors; comparison
17+
.. _query-selectors-comparison:
18+
1619
Comparison
1720
~~~~~~~~~~
1821

@@ -94,6 +97,9 @@ This statement returns all documents with ``field`` between
9497

9598
{ field: [-1,3] }
9699

100+
.. index:: query selectors; document
101+
.. _query-selectors-document:
102+
97103
Document
98104
~~~~~~~~
99105

@@ -203,6 +209,9 @@ Document
203209
returns all documents in ``collection`` where the value of ``age``
204210
is *not* 3, 5, or 7.
205211

212+
213+
.. index:: query selectors; geospatial
214+
.. _query-selectors-geospatial:
206215
.. _geospatial-query-operators:
207216
.. _geolocation-operators:
208217

@@ -319,6 +328,9 @@ Geospatial
319328
You cannot specify :operator:`$uniqueDocs` with :operator:`$near`
320329
or haystack queries.
321330

331+
.. index:: query selectors; logical
332+
.. _query-selectors-logical:
333+
322334
Logical
323335
~~~~~~~
324336

@@ -348,7 +360,7 @@ Logical
348360
field that has the value ``19``, and *either* a ``key1`` field with
349361
``value1`` *or* a ``key2`` field with ``value2``.
350362

351-
.. versionadded: 2.0
363+
.. versionadded:: 2.0
352364
You may nest :operator:`$or` operations; however, these
353365
expressions are not as efficiently optimized as top-level
354366
:operator:`$or` operations.
@@ -422,6 +434,9 @@ Logical
422434

423435
.. see:: The :operator:`$type` operator, used in the above example.
424436

437+
.. index:: query selectors; element
438+
.. _query-selectors-element:
439+
425440
Element
426441
~~~~~~~
427442

@@ -524,7 +539,6 @@ Element
524539
- ``s`` allows the dot (e.g. ``.``) character to match all
525540
characters *including* newline characters.
526541

527-
528542
:option:`$regex` only provides the ``i` and ``m`` options in the
529543
short JavaScript syntax (i.e. ``/acme.*corp/i``). To use ``x``
530544
and ``s`` you must use the ":operator:`$regex`" operator with the
@@ -569,6 +583,9 @@ Element
569583

570584
db.collection.find( "field % d == m" );
571585

586+
.. index:: query selectors; javascript
587+
.. _query-selectors-javascript:
588+
572589
JavaScript
573590
~~~~~~~~~~
574591

@@ -595,6 +612,9 @@ JavaScript
595612
standard query operator to filter the result set. Using
596613
:operator:`$where` alone requires a table scan.
597614

615+
.. index:: query selectors; array
616+
.. _query-selectors-array:
617+
598618
Array
599619
~~~~~
600620

@@ -656,11 +676,20 @@ Array
656676

657677
{ array: [ { value1:1, value2:0 }, { value1:1, value2:2 } ] }
658678

679+
.. index:: operators; update
680+
.. index:: update operators
659681
.. _update-operators:
660682

661683
Update
662684
------
663685

686+
.. index:: update operators; fields
687+
.. _operators-update-fields:
688+
.. _update-operators-fields:
689+
690+
Fields
691+
~~~~~~
692+
664693
.. operator:: $set
665694

666695
Use the :operator:`$set` operator to set a particular value. The
@@ -725,6 +754,32 @@ Update
725754

726755
:operator:`$inc` accepts positive and negative incremental amounts.
727756

757+
.. operator:: $rename
758+
759+
The :operator:`$rename` operator changes the name of a field. Consider the
760+
following example:
761+
762+
.. code-block:: javascript
763+
764+
db.collection.update( { field: value }, { $rename: { old_field: new_field } } );
765+
766+
Here, the :operator:`$rename` operator changes the name of the ``old_field``
767+
field to ``new_field``, in the document that matches the query ``{
768+
field: value }`` in ``collection``.
769+
770+
The :operator:`$rename` operator will expand arrays and
771+
sub-documents to find a match for field names (e.g. ``old_field``
772+
in the example above.)
773+
774+
.. versionadded:: 1.7.2
775+
776+
.. index:: update operators; array
777+
.. _operators-update-array:
778+
.. _update-operators-array:
779+
780+
Array
781+
~~~~~
782+
728783
.. operator:: $push
729784

730785
The :operator:`$push` operator appends a specified value to an array. For
@@ -853,24 +908,12 @@ Update
853908
the array in ``field1``, in the document that matches the
854909
query statement ``{ field: value }`` in ``collection``.
855910

856-
.. operator:: $rename
857-
858-
The :operator:`$rename` operator changes the name of a field. Consider the
859-
following example:
911+
.. index:: update operators; bitwise
912+
.. _operators-update-bitwise:
913+
.. _update-operators-bitwise:
860914

861-
.. code-block:: javascript
862-
863-
db.collection.update( { field: value }, { $rename: { old_field: new_field } } );
864-
865-
Here, the :operator:`$rename` operator changes the name of the ``old_field``
866-
field to ``new_field``, in the document that matches the query ``{
867-
field: value }`` in ``collection``.
868-
869-
The :operator:`$rename` operator will expand arrays and
870-
sub-documents to find a match for field names (e.g. ``old_field``
871-
in the example above.)
872-
873-
.. versionadded:: 1.7.2
915+
Bitwise
916+
~~~~~~~
874917

875918
.. operator:: $bit
876919

@@ -885,6 +928,13 @@ Update
885928
named ``field`` with a bitwise ``and: 5`` operation. This
886929
operator only works with number types.
887930

931+
.. index:: update operators; isolation
932+
.. _operators-update-isolation:
933+
.. _update-operators-isolation:
934+
935+
Isolation
936+
~~~~~~~~~
937+
888938
.. operator:: $atomic
889939

890940
In multi-update mode, it's possible to specify an
@@ -905,6 +955,7 @@ Update
905955
.. seealso:: See :func:`db.collection.update()` for more information about the
906956
:func:`db.collection.update()` method.
907957

958+
.. index:: projection operators
908959
.. _projection-operators:
909960

910961
Projection

0 commit comments

Comments
 (0)