const db = cloud.database() // 云函数入口函数 exports.main = async (event, context) => { try { return await db.collection('PLgame').where({ GZT: 0,//空闲中 }).limit(4).update({ data: { GZT: 1 }, }) } catch (e) { console.error(e) }; }
|
我只想修改符合条件的前4条数据,使用limit(4)限制没起作用,代码该怎么写
已经过去一年了, 这么重要的功能还不支持吗...
限制不了的
先取出前四条数据_id,组成一个数组ids
where({
_id: _.in(ids)
}).update({...})