Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. * There is no exposed reference from the model to bookshelf (e.g. can't do something like `Ad.Bookshelf.knex`). Need to require the bookshelf instance itself.
  2.  
  3. ### Getting count of models matching certain criteria
  4. ```js
  5. // select count(*) from "ads" where "classified_id" = 2'
  6. Ad.where({ classified_id: 2 })
  7. .query() // <- returns QueryBuild instance
  8. .count()
  9. .then(function (count) {
  10. console.log('\n***', count);
  11. });
  12. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement