收藏
回答

云开发aggregate过程 字段中类型为对象字段中的子字段 sort 排序?

小程序云开发:aggregate经过一系列过程后,结果有如下数据

cList: Array(5)

0: {_id: "479b5c3d1bcf437abe936be6e4d300a5", pu: "", wt: "1", ps: 4, timedt: Array(1)0: {timestart: "15:10", timeend: "15:20"}}

1: {_id: "52135186a3bc402984b21fdd90b534a4", pu: "", wt: "1", ps: 4, timedt: Array(1)0: {timestart: "07:20", timeend: "07:50"}}

2: {_id: "2900f25641424fc6802b7aa434a307a3", pu: "", wt: "1", ps: 4, timedt: Array(1)0: {timestart: "18:30", timeend: "19:10"}}

3: {_id: "f32dbb24d95f4e859a63fce8e446a1e9", pu: "", wt: "1", ps: 4, timedt: Array(1)0: {timestart: "09:35", timeend: "09:45"}}

4: {_id: "3efd74e763064200863e6c2e8c4fa981", pu: "", wt: "d", ps: 4, timedt: Array(1)0: {timestart: "16:45", timeend: "17:25"}}

现在希望这个cList: Array(5)按照字段timedt 之下的timestart字段升序排列输出cList结果

        .sort({

          这里应该怎么写????

        })

        .done(),

        as:'cList'

一般sort 是 pu:1 这样写,这里 timedt下面的timestart排序,如何写?

回答关注问题邀请回答
收藏
登录 后发表内容