Skip to content

Commit 3ec29e9

Browse files
author
Sam Kleinman
committed
merge: DOCS-503
2 parents a308cbd + 3f1de0c commit 3ec29e9

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

source/reference/operator/positional.txt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
.. operator:: $
88

9-
*Syntax*: ``{ "array.$" : value }``
9+
*Syntax*: ``{ "<array>.$" : value }``
1010

1111
The positional :operator:`$` operator identifies an element in an
1212
``array`` field to update without explicitly specifying the position
@@ -29,9 +29,9 @@
2929
{ "_id" : 2, "grades" : [ 88, 90, 92 ] }
3030
{ "_id" : 3, "grades" : [ 85, 100, 90 ] }
3131

32-
To update ``80`` to ``82`` in the ``grades`` array field in the
33-
first document, you can use the positional :operator:`$` operator if
34-
you did not know the position of the element in the array:
32+
To update ``80`` to ``82`` in the ``grades`` array in the
33+
first document, use the positional :operator:`$` operator if
34+
you do not know the position of the element in the array:
3535

3636
.. code-block:: javascript
3737

@@ -41,9 +41,10 @@
4141
placeholder for the **first match** of the update ``query selector``.
4242

4343
The positional :operator:`$` operator facilitates updates to arrays
44-
that contain embedded documents. You can access the fields in the
45-
embedded documents by applying the dot-notation on the :operator:`$`
46-
operator.
44+
that contain embedded documents. Use the positional :operator:`$`
45+
operator to access the fields in the embedded documents with the
46+
:wiki:`dot notation <Dot+Notation+(Reaching+into+Objects)>` on the
47+
:operator:`$` operator.
4748

4849
.. code-block:: javascript
4950

@@ -58,9 +59,8 @@
5859
{ grade: 85, mean: 90, std: 5 },
5960
{ grade: 90, mean: 85, std: 3 } ] }
6061

61-
To update the ``std`` value of the embedded document with the
62-
``grade`` of ``85``, you can use the positional :operator:`$`
63-
operator:
62+
Use the positional :operator:`$` operator to update the value of the
63+
``std`` field in the embedded document with the ``grade`` of ``85``:
6464

6565
.. code-block:: javascript
6666

@@ -79,4 +79,5 @@
7979

8080
.. seealso::
8181

82-
:method:`update() <db.collection.update()>`, :operator:`$set`.
82+
:method:`update() <db.collection.update()>`, :operator:`$set` and
83+
:operator:`$unset`

0 commit comments

Comments
 (0)