File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
reference/operator/update Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change
1
+ :update: `$currentDate ` sets the specified field to the date when
2
+ :update: `$currentDate ` was run.
Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ Behavior
43
43
44
44
.. include:: /includes/fact-update-operator-processing-order.rst
45
45
46
+ .. include:: /includes/update-current-date.rst
47
+
46
48
If the field does not exist, :update:`$currentDate` adds the field to a
47
49
document.
48
50
@@ -82,13 +84,15 @@ as well as updating the ``status`` field to ``"D"`` and the
82
84
}
83
85
)
84
86
85
- After the operation, you can query the collection to verify the update:
87
+ .. include:: /includes/update-current-date.rst
88
+
89
+ To verify the update:
86
90
87
91
.. code-block:: javascript
88
92
89
93
db.customers.find()
90
94
91
- The updated document would resemble :
95
+ The updated document resembles :
92
96
93
97
.. code-block:: javascript
94
98
:copyable: false
@@ -103,6 +107,9 @@ The updated document would resemble:
103
107
}
104
108
}
105
109
110
+ The ``lastModified`` field is set to the date when
111
+ :update:`$currentDate` was run in the update example shown earlier.
112
+
106
113
.. _currentDate-example-agg:
107
114
108
115
Aggregation Alternative to ``$currentDate``
You can’t perform that action at this time.
0 commit comments