- 云开发,集合有两条数据,怎么取学校1,学院2,专业2的majorBookList数组?
data: [ { _id: '1', schoolName: '学校1', academyList: [ { academyId: '1', academyName: '学院1', majorList: [ { majorId: '1', majorName: '专业1', majorBookList: [], }, ] }, { academyId: '2', academyName: '学院2', majorList: [ { majorId: '1', majorName: '专业1', majorBookList: [], }, { majorId: '2', majorName: '专业2', majorBookList: [], }, ] }, ], }, { _id: '2', schoolName: '学校2, academyList: [], }, ]
2022-03-23 - 云开发,集合有两条数据,怎么取学校1,学院2,专业2的majorBookList数组?
data: [ { _id: '1', schoolName: '学校1', academyList: [ { academyId: '1', academyName: '学院1', majorList: [ { majorId: '1', majorName: '专业1', majorBookList: [], }, ] }, { academyId: '2', academyName: '学院2', majorList: [ { majorId: '1', majorName: '专业1', majorBookList: [], }, { majorId: '2', majorName: '专业2', majorBookList: [], }, ] }, ], }, { _id: '2', schoolName: '学校2, academyList: [], }, ]
2022-03-09 - 微信小程序云开发,想要过滤集合中对象数组嵌套对象数组中的某一字段?
以下代码报错FieldPath字段名不能以“$”开头?还有什么方法吗? await db.collection('school') .aggregate() .match({ schoolName: event.schoolName }) .project({ publicBookList: 0, examBookList: 0, "academyList.$[].majorList.$[].majorBookList": 0, }) .end()
2022-03-07