const db = uniCloud.database()
exports.main = async (event, context) => {
let {num}=event
let arr = await db.collection("user").limit(num).orderBy("_id","asc").get()
return arr
};
orderby,按照_id字段 asc顺序排列
const db = uniCloud.database()
exports.main = async (event, context) => {
let {num}=event
let arr = await db.collection("user").limit(num).orderBy("_id","desc").get()
return arr
};
desc倒序排列,从后往前获取num条数据