Skip to content

Commit 9d34318

Browse files
jason-price-mongodbjason-price-mongodb
andauthored
DOCSP-25353 current date updates (#1931) (#1944)
* DOCSP-25353-current-date-updates * DOCSP-25353-current-date-updates * DOCSP-25353-current-date-updates * DOCSP-25353-current-date-updates Co-authored-by: jason-price-mongodb <[email protected]> Co-authored-by: jason-price-mongodb <[email protected]>
1 parent 4937691 commit 9d34318

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:update:`$currentDate` sets the specified field to the date when
2+
:update:`$currentDate` was run.

source/reference/operator/update/currentDate.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ Behavior
4343

4444
.. include:: /includes/fact-update-operator-lexicographic-order.rst
4545

46+
.. include:: /includes/update-current-date.rst
47+
4648
If the field does not exist, :update:`$currentDate` adds the field to a
4749
document.
4850

@@ -80,13 +82,15 @@ as well as updating the ``status`` field to ``"D"`` and the
8082
}
8183
)
8284

83-
After the operation, you can query the collection to verify the update:
85+
.. include:: /includes/update-current-date.rst
86+
87+
To verify the update:
8488

8589
.. code-block:: javascript
8690

8791
db.customers.find().pretty()
8892

89-
The updated document would resemble:
93+
The updated document resembles:
9094

9195
.. code-block:: javascript
9296
:copyable: false
@@ -101,6 +105,9 @@ The updated document would resemble:
101105
}
102106
}
103107

108+
The ``lastModified`` field is set to the date when
109+
:update:`$currentDate` was run in the update example shown earlier.
110+
104111
.. _currentDate-example-agg:
105112

106113
Aggregation Alternative to ``$currentDate``

0 commit comments

Comments
 (0)