Skip to content

Commit ce8d3ee

Browse files
author
Sam Kleinman
committed
DOCS-1114: clarify assurances of $addToSet
1 parent 89105e9 commit ce8d3ee

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

source/reference/operator/addToSet.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ $addToSet
99
The :operator:`$addToSet` operator adds a value to an array only *if* the
1010
value is *not* in the array already. If the value *is* in the
1111
array, :operator:`$addToSet` returns without modifying the
12-
array. Otherwise, :operator:`$addToSet` behaves the same as
13-
:operator:`$push`. Consider the following example:
12+
array. Consider the following example:
1413

1514
.. code-block:: javascript
1615

@@ -20,5 +19,11 @@ $addToSet
2019
``field``, *only if* ``value1`` is not already a member of this
2120
array.
2221

23-
.. see:: :operator:`$each`
22+
.. note::
23+
24+
:operator:`$addToSet` only ensures that there are no duplicate
25+
items in a set and makes no guarantees regarding the order of
26+
the elements in the set.
27+
28+
.. see:: :operator:`$each` and :operator:`$push`
2429

0 commit comments

Comments
 (0)