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:
192
192
193
193
- | Returns true.
194
194
195
+ * - Timestamp
196
+
197
+ - | Returns true.
198
+
195
199
The following table lists some conversion to boolean examples:
196
200
197
201
.. list-table::
@@ -913,6 +917,10 @@ date:
913
917
- Returns a date that corresponds to the timestamp of the
914
918
ObjectId.
915
919
920
+ * - Timestamp
921
+
922
+ - Returns a date that corresponds to the timestamp.
923
+
916
924
The following table lists some conversion to date examples:
917
925
918
926
.. list-table::
@@ -983,6 +991,12 @@ The following table lists some conversion to date examples:
983
991
}
984
992
- "Could not convert to type date."
985
993
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
+
986
1000
987
1001
.. seealso::
988
1002
Original file line number Diff line number Diff line change @@ -109,6 +109,10 @@ date:
109
109
- Returns a date that corresponds to the timestamp of the
110
110
ObjectId.
111
111
112
+ * - Timestamp
113
+
114
+ - Returns a date that corresponds to the timestamp.
115
+
112
116
The following table lists some conversion to date examples:
113
117
114
118
.. list-table::
@@ -142,6 +146,9 @@ The following table lists some conversion to date examples:
142
146
* - ``{$toDate: "Friday"}``
143
147
- Error
144
148
149
+ * - ``{$toDate: Timestamp({ t: 1637688118, i: 1 })}``
150
+ - ISODate("2021-11-23T17:21:58.00Z")
151
+
145
152
Example
146
153
-------
147
154
Original file line number Diff line number Diff line change @@ -45,6 +45,16 @@ MongoDB 5.2 introduces the following aggregation operators:
45
45
* - :expression:`$sortArray`
46
46
- Sorts an array based on its elements.
47
47
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
+
48
58
.. _5.2-rel-notes-sharding:
49
59
50
60
Sharding
You can’t perform that action at this time.
0 commit comments