How can I get the number of rows (without any filter)?
I've tried this User.fetch().count()
and User.count()
, but I get these errors respectively:
TypeError: User.fetch is not a function
AssertionError: expected { Object (_bitField, _fulfillmentHandler0, ...) } to equal 0
Here's my model:
let bookshelf = require('../config/database');
require('./role');
var User = bookshelf.Model.extend({
tableName: 'users',
role: function() {
return this.hasOne(Role);
}
});
module.exports = bookshelf.model('User', User);
via Juliano Nunes Silva Oliveira
No comments:
Post a Comment