The first
function gets the first row in a set of matching rows.
It should be used with orderBy
to specify an ordering.
let c = Customer[id > 10].orderBy('id').first() //find first customer with id > 10
The last
function gets the last row in a set of matching rows.
It should be used with orderBy
to specify an ordering.
let c = Customer[id > 10].orderBy('id').last() //find last customer with id > 10
The ith
function gets the i-th row in a set of matching rows.
It takes an integer parameter that is the 0-based index.
It should be used with orderBy
to specify an ordering.
let c = Customer[id > 10].orderBy('id').ith(2) //find 3rd customer with id > 10