File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
source/reference/operator Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,7 @@ $addToSet
9
9
The :operator:`$addToSet` operator adds a value to an array only *if* the
10
10
value is *not* in the array already. If the value *is* in the
11
11
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:
14
13
15
14
.. code-block:: javascript
16
15
@@ -20,5 +19,11 @@ $addToSet
20
19
``field``, *only if* ``value1`` is not already a member of this
21
20
array.
22
21
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`
24
29
You can’t perform that action at this time.
0 commit comments