应不会
为什么用小程序连接蓝牙外围设备,得到的蓝牙设备名都是“未知设备”?[图片]
2021-09-29// 云函数入口文件 const cloud = require('wx-server-sdk') cloud.init() const db=cloud.database() const _ = db.command const $ = db.command.aggregate // 云函数入口函数 exports.main = async(event, context) => { const wxContext = cloud.getWXContext() return new Promise((resolve,reject)=>{ db.collection('category').aggregate() .lookup({ from: 'category', localField: 'nameA', foreignField: 'nameA', as: 'bookList', }) .project({ nameA: 1, nameB: 1, bookList: 1 }) .replaceRoot({ newRoot: { nameA: '$nameA', nameB: '$nameB', images: '$bookList' } }) .group({ _id: '$nameA', child: $.addToSet({ nameB: '$nameB', images: $.filter({ input: '$images', as: 'item', cond: $.eq(['$$item.nameB', '$nameB']) }) }) }) .end() .then((res)=>{resolve(res)}) .catch((err)=>{console.log(err)}) }) }
如何将数组中的相同二级分类再合并?原始数据:[{ { "_id": "8d65afde5e4d2a79010af3ae173f3c31", "imageC": "http://tmp/wx9696d4e5754a92b0.o6zAJs_sYdqkP5OplRpgfPIz-Vis.9cIQCAVc8Pe4a3f590515973ba69b44c5f86b56dff81.png", "nameA": "A", "nameB": "A3", "nameC": "E3333" }, { "_id": "8d65afde5e4d2a79010af3b03f094576", "imageC": "http://tmp/wx9696d4e5754a92b0.o6zAJs_sYdqkP5OplRpgfPIz-Vis.9cIQCAVc8Pe4a3f590515973ba69b44c5f86b56dff81.png", "nameA": "A", "nameB": "A3", "nameC": "E3333" }, { "_id": "fb16f7905e4d2c00010c97000eab34a6", "imageC": "http://tmp/wx9696d4e5754a92b0.o6zAJs_sYdqkP5OplRpgfPIz-Vis.9cIQCAVc8Pe4a3f590515973ba69b44c5f86b56dff81.png", "nameA": "B", "nameB": "A5", "nameC": "E3333" }, { "_id": "4278fc3a5e4d2c080109a9095277efc3", "imageC": "http://tmp/wx9696d4e5754a92b0.o6zAJs_sYdqkP5OplRpgfPIz-Vis.9cIQCAVc8Pe4a3f590515973ba69b44c5f86b56dff81.png", "nameA": "B", "nameB": "A5", "nameC": "E222222" }, { "_id": "fb16f7905e4d2c0f010c9de51a769a17", "imageC": "http://tmp/wx9696d4e5754a92b0.o6zAJs_sYdqkP5OplRpgfPIz-Vis.9cIQCAVc8Pe4a3f590515973ba69b44c5f86b56dff81.png", "nameA": "B", "nameB": "A5", "nameC": "E11111" }, { "_id": "e30d61715e4d2c15010a550712a94455", "imageC": "http://tmp/wx9696d4e5754a92b0.o6zAJs_sYdqkP5OplRpgfPIz-Vis.9cIQCAVc8Pe4a3f590515973ba69b44c5f86b56dff81.png", "nameA": "B", "nameB": "A4", "nameC": "E11111" }, { "_id": "7d79e8035e4d2c1b010b25d421d9aabc", "imageC": "http://tmp/wx9696d4e5754a92b0.o6zAJs_sYdqkP5OplRpgfPIz-Vis.9cIQCAVc8Pe4a3f590515973ba69b44c5f86b56dff81.png", "nameA": "B", "nameB": "A4", "nameC": "E222222" }, { "_id": "7d79e8035e4d2c23010b29a05652d1ad", "imageC": "http://tmp/wx9696d4e5754a92b0.o6zAJs_sYdqkP5OplRpgfPIz-Vis.9cIQCAVc8Pe4a3f590515973ba69b44c5f86b56dff81.png", "nameA": "B", "nameB": "A4", "nameC": "E3333" }, { "_id": "8d65afde5e4d2c2b010bd06b467f35c3", "imageC": "http://tmp/wx9696d4e5754a92b0.o6zAJs_sYdqkP5OplRpgfPIz-Vis.9cIQCAVc8Pe4a3f590515973ba69b44c5f86b56dff81.png", "nameA": "B", "nameB": "A3", "nameC": "E3333" }, { "_id": "e30d61715e4d2c30010a62d60a9231b1", "imageC": "http://tmp/wx9696d4e5754a92b0.o6zAJs_sYdqkP5OplRpgfPIz-Vis.9cIQCAVc8Pe4a3f590515973ba69b44c5f86b56dff81.png", "nameA": "B", "nameB": "A3", "nameC": "E2222" } ] {[图片] 全成后希望变成相同的nameB的image子项并成一个数组,请指教!!! [ { "_id": "C", "child": [ { "nameB": "A3", "image": [{ "nameC": "E1111", "imageC": "http://tmp/wx9696d4e5754a92b0.o6zAJs_sYdqkP5OplRpgfPIz-Vis.9cIQCAVc8Pe4a3f590515973ba69b44c5f86b56dff81.png" }, { "nameC": "E22222", "imageC": "http://tmp/wx9696d4e5754a92b0.o6zAJs_sYdqkP5OplRpgfPIz-Vis.9cIQCAVc8Pe4a3f590515973ba69b44c5f86b56dff81.png" }, { "nameC": "E33333", "imageC": "http://tmp/wx9696d4e5754a92b0.o6zAJs_sYdqkP5OplRpgfPIz-Vis.9cIQCAVc8Pe4a3f590515973ba69b44c5f86b56dff81.png" } ]
2020-02-24[图片]
云函数已连接数据库,如何实现前端录入项目时,子项和父项会自动分类到数据库。实现相应子项自增?[图片][图片][图片] 求解!!!!!!!!!!!!!
2020-02-15求解?
选择图片后为什么用this.setData()不能将图片传到data{}里?[图片][图片]
2020-02-08[图片]
前端连不上云函数,求解?[图片][图片] 前端与后端写了代码,云函数也上传,但用前端data向云函数event传数据时, return没有反回数据,求解?
2020-02-06代码,看下
如制作实现订单流水号?我要制作一个表单,每个表单提交后生成一个流水号,请问这个流水号如何用代码实现?
2019-11-02