On this page本页内容
$isoWeek¶New in version 3.4.版本3.4中的新功能。
Returns the week number in ISO 8601 format, ranging from 返回ISO 8601格式的周数,范围从1 to 53. 1到53。Week numbers start at 周数从1 with the week (Monday through Sunday) that contains the year’s first Thursday.1开始,以包含一年中第一个星期四的一周(周一到周日)为单位。
The $isoWeek expression has the following operator expression syntax:$isoWeek表达式具有以下运算符表达式语法:
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 |
<dateExpression> must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID.<dateExpression>必须是解析为Date、Timestamp或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:操作返回以下结果: