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

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -