5.3.2.8. limit

cloud.database.collection.limit(max)
参数
  • max (number) – 最大结果集返回数量,上限 100

返回类型

Collection | Query

示例

const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database()
exports.main = async (event, context) => {
  try {
    return await db.collection('todos').limit(10).get()
  } catch (e) {
    console.error(e)
  }
}