嗨,根据MongoDB汇总,我有一个问题。
我想分割日期列表
"checked" : [
ISODate("2018-11-01T07:00:00.000+0000"),
ISODate("2018-11-01T15:00:00.000+0000"),
ISODate("2018-11-02T07:00:00.000+0000"),
ISODate("2018-11-02T15:00:00.000+0000"),
ISODate("2018-11-03T07:00:00.000+0000"),
ISODate("2018-11-03T15:00:00.000+0000"),
ISODate("2018-11-04T07:00:00.000+0000"),
ISODate("2018-11-04T15:00:00.000+0000"),
ISODate("2018-12-01T07:00:00.000+0000"),
ISODate("2018-12-01T15:00:00.000+0000"),
ISODate("2018-12-02T07:00:00.000+0000"),
ISODate("2018-12-02T15:00:00.000+0000"),
ISODate("2018-12-03T07:00:00.000+0000"),
ISODate("2018-12-03T15:00:00.000+0000"),
ISODate("2018-12-04T07:00:00.000+0000"),
ISODate("2018-12-04T15:00:00.000+0000")
]
分成2个元素的小数组,如下所示:
"checked" : [
[
ISODate("2018-11-01T07:00:00.000+0000"),
ISODate("2018-11-01T15:00:00.000+0000")
],
[
ISODate("2018-11-02T07:00:00.000+0000"),
ISODate("2018-11-02T15:00:00.000+0000")
],
[
ISODate("2018-11-03T07:00:00.000+0000"),
ISODate("2018-11-03T15:00:00.000+0000")
],
...
]
是否有可能实现这一目标?
我看到有一个$ split但可以在字符串上工作。还有减少,但减少了。