Details
Description
The $dateToParts expression operator return a document with "isoYear" and "isoWeekYear" fields that confusingly correspond to the return values of the $isoWeekYear and $isoWeek expression operators, respectively. I think we should change the $dateToParts expression operator to use the field names of "isoWeekYear" and "isoWeek" to match the behavior of the existing $isoWeekYear and $isoWeek expression operators.
Note: We'll want to change $dateFromParts to take the "isoWeekYear" and "isoWeek" field names instead too.
> db.mycoll.aggregate([{$addFields: {
|
parts: {$dateToParts: {date: "$date", iso8601: true}},
|
isoWeekYear: {$isoWeekYear: "$date"},
|
isoWeek: {$isoWeek: "$date"},
|
}}]).toArray()
|
[
|
{
|
"_id" : ObjectId("59ce4f35ac2831cef80ed375"),
|
"date" : ISODate("2017-09-29T13:48:37.665Z"),
|
"parts" : {
|
"isoYear" : 2017,
|
"isoWeekYear" : 39,
|
"isoDayOfWeek" : 5,
|
"hour" : 13,
|
"minute" : 48,
|
"second" : 37,
|
"millisecond" : 665
|
},
|
"isoWeekYear" : NumberLong(2017),
|
"isoWeek" : 39
|
}
|
]
|
Attachments
Issue Links
- is documented by
-
DOCS-10856 rename fields returned by $dateToParts
-
- Closed
-