On this page本页内容
$isoWeek¶New in version 3.4.版本3.4中的新功能。
Returns the week number in ISO 8601 format, ranging from 1 to 53. Week numbers start at 1 with the week (Monday through Sunday) that contains the year’s first Thursday.
The $isoWeek 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 | |
|---|---|
| 1 | |
| 53 | |
| 32 | |
| 45 | |
| 44 | |
error | |
error | |
error |
Note
$isoWeek cannot take a string as an argument.
A collection called 名为deliveries contains the following documents:deliveries的集合包含以下文档:
The following operation returns the week number for each 以下操作返回每个date field.date字段的周数。
The operation returns the following results:操作返回以下结果: