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 @@ -42,6 +42,8 @@ Definition
42
42
Behavior
43
43
--------
44
44
45
+ .. include:: /includes/update-current-date.rst
46
+
45
47
If the field does not exist, :update:`$currentDate` adds the field to a
46
48
document.
47
49
@@ -79,13 +81,15 @@ as well as updating the ``status`` field to ``"D"`` and the
79
81
}
80
82
)
81
83
82
- After the operation, you can query the collection to verify the update:
84
+ .. include:: /includes/update-current-date.rst
85
+
86
+ To verify the update:
83
87
84
88
.. code-block:: javascript
85
89
86
90
db.customers.find().pretty()
87
91
88
- The updated document would resemble :
92
+ The updated document resembles :
89
93
90
94
.. code-block:: javascript
91
95
:copyable: false
@@ -100,6 +104,9 @@ The updated document would resemble:
100
104
}
101
105
}
102
106
107
+ The ``lastModified`` field is set to the date when
108
+ :update:`$currentDate` was run in the update example shown earlier.
109
+
103
110
.. _currentDate-example-agg:
104
111
105
112
Aggregation Alternative to ``$currentDate``
You can’t perform that action at this time.
0 commit comments