On this page本页内容
$isoWeekYear
¶New in version 3.4.版本3.4中的新功能。
Returns the year number in ISO 8601 format. The year starts with the Monday of week 1 and ends with the Sunday of the last week.
The $isoWeekYear
expression has the following operator expression syntax:
Changed in version 3.6.在版本3.6中更改。
The argument must be a valid expression that resolves to one of the following:
New in version 3.6.版本3.6中的新功能。
date |
The date to which the operator is applied. <dateExpression> must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. | ||||||
timezone |
|
Result | |
---|---|
2015 | |
2003 | |
2017 | |
2016 | |
2024 | |
error | |
error | |
error |
Note
$isoWeekYear
cannot take a string as an argument.
A collection called anniversaries
contains the following documents:
The following operation returns the year number in ISO 8601 format for each date
field.
The operation returns the following results:操作返回以下结果: