bookshelf-modelbase
bookshelf-modelbase copied to clipboard
findAll: format attributes filter
.forge()
enables case-converter(https://github.com/bookshelf/bookshelf/blob/master/lib/plugins/case-converter.js), but .where()
does not do case convert like forge()
.
https://github.com/bookshelf/bookshelf/blob/b6abda9486b3f06d1ee58aff063c14836f0a2e1d/lib/model.js#L1317-L1319
(.where just call .where on query builder)
We should let findAll
and findOne
have the same case converting behavior
That makes sense. It'll be a breaking change so I'll need work it into a major relase
I found that this is not working:
this.forge(extend({}, filter)).fetchAll(options);
(got select command with no where condition)
But this works:
const model = this.forge();
return model.where(model.format(extend({}, filter))).fetchAll(options)
Just format attributes for where.