# Collection.limit / Query.limit
Specifies the maximum number of result sets.
The method signature is shown as below:
function limit(max: number): Collection | Query
The method accepts a required parameter max to define the number of returned maximum result sets, which is up to 100.
Sample code
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)
}
}