Measure an operation in milliseconds.
async function handler(state) {
state.timer.start('users')
var users = await state.plugins.mongodb
.collection('users').find({}).toArray()
var ms = state.timer.end('users')
console.log(ms)
console.log(state.timer.values.users)
return users
}
Start a named timer before ending it. Reusing the name starts a new measurement. See Connect for the database plugin.
Next: Schemas →