File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed
reference/operator/aggregation Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,10 @@ boolean:
192192
193193 - | Returns true.
194194
195+ * - Timestamp
196+
197+ - | Returns true.
198+
195199The following table lists some conversion to boolean examples:
196200
197201.. list-table::
@@ -913,6 +917,10 @@ date:
913917 - Returns a date that corresponds to the timestamp of the
914918 ObjectId.
915919
920+ * - Timestamp
921+
922+ - Returns a date that corresponds to the timestamp.
923+
916924The following table lists some conversion to date examples:
917925
918926.. list-table::
@@ -983,6 +991,12 @@ The following table lists some conversion to date examples:
983991 }
984992 - "Could not convert to type date."
985993
994+ * - .. code-block:: javascript
995+ :copyable: false
996+
997+ { input: Timestamp({ t: 1637688118, i: 1 }), to: "date" }
998+ - ISODate("2021-11-23T17:21:58.00Z")
999+
9861000
9871001.. seealso::
9881002
Original file line number Diff line number Diff line change @@ -109,6 +109,10 @@ date:
109109 - Returns a date that corresponds to the timestamp of the
110110 ObjectId.
111111
112+ * - Timestamp
113+
114+ - Returns a date that corresponds to the timestamp.
115+
112116The following table lists some conversion to date examples:
113117
114118.. list-table::
@@ -142,6 +146,9 @@ The following table lists some conversion to date examples:
142146 * - ``{$toDate: "Friday"}``
143147 - Error
144148
149+ * - ``{$toDate: Timestamp({ t: 1637688118, i: 1 })}``
150+ - ISODate("2021-11-23T17:21:58.00Z")
151+
145152Example
146153-------
147154
Original file line number Diff line number Diff line change @@ -45,6 +45,16 @@ MongoDB 5.2 introduces the following aggregation operators:
4545 * - :expression:`$sortArray`
4646 - Sorts an array based on its elements.
4747
48+ General Aggregation Improvements
49+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50+
51+ :expression:`convert` Supports Timestamp Conversion to Date
52+ ```````````````````````````````````````````````````````````
53+
54+ Starting in MongoDB 5.2, you can convert timestamps to dates using the
55+ :expression:`$convert` operator. The :expression:`$toDate` operator can
56+ also convert timestamps.
57+
4858.. _5.2-rel-notes-sharding:
4959
5060Sharding
You can’t perform that action at this time.
0 commit comments