-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hasMany countAccessor #68
Comments
Yes, absolutely. But you might need to use the git version for a while when I implement it. |
Wait.. (so many stuff I sometimes forget about features). Try this: Controller var Category = require('../models/Category');
exports.countSuccessors = function(req, res, next) {
category_id = Number(req.params['category']);
Category(category_id).getSuccessors({ distance: 1 }).count(function (err, count) {
res.json(count);
});
} Explanation: calling the https://github.com/dresende/node-orm2/blob/master/lib/ChainFind.js#L31 |
Hi, SELECT COUNT(*) AS `c` FROM `category` WHERE (`distance` = 1) Have last versions of orm and sql-query. |
I have to look at this closer, it seems the chain is not taking care of the join option.. |
This is required when using the countAccessor from hasMany associations to be able to JOIN tables
I think I solved it, please try the latest git. |
Hi, |
Hello,
is possible to add countAccessor to Many association?
Model
Controller
The text was updated successfully, but these errors were encountered: