Is it possible to fetch all records of a table in bookshelf without a query?
I'v got a Model named Person, and I'd like to retrieve all of its records.
What I am doing currently is this:
Person.where('id', '>', 0) ).fetchAll()
.then((result) => {
// doing stuff
});
which just doesn't feel right.
I was hoping for something like
// using empty querybuilder
Person.query().fetchAll()
or
Person.all //
Am I missing something?
I suppose model.fetchAll
is the thing you are looking for.
Simple helper function for retrieving all instances of the given model.
See the API Reference of Bookshelf.js