AggregateCommand.arrayElemAt中的示例代码有误
发布于 5 年前 作者 lizhou 3863 次浏览 来自 官方Issues

https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/database/command/aggregate/AggregateCommand.arrayElemAt.html

$.arraElemAt应该为:$.arrayElemAt,缺少了字母y

求各个第一次考试的分数和和最后一次的分数:

const $ = db.command.aggregate
db.collection('exams').aggregate()
  .project({
    first: $.arraElemAt(['$scores', 0]),
    last: $.arraElemAt(['$scores', -1]),
  })
  .end()
1 回复

你好,再看下呢

回到顶部