node.js - Total count without limit -
i doing paging using limit , offset:
test.query(function(q){ q.where('testname', 'like', '%test%') .orwhere('testno', '1234') .limit(limit) .offset(offset); }) .fetchall()
how can total count without limit?
you need use model.count
think following should work
var q = test .where('testname', 'like', '%test%') .orwhere('testno', '1234'); q.limit(limit) .offset(offset) .then(function(results){ q.count('id').then(...) })
Comments
Post a Comment