related-reference-counter
v2.0.3
Published
count references, order by them
Downloads
5
Readme
related-reference-counter
Count references items on your entities.
API
Get an related ORM instance
var RelatedORM = require('related')
, RelatedReferenceCounter = require('related-reference-counter')
var related = new RelatedORM(config);
Add the extension
related.use(new RelatedReferenceCounter());
Count references on an entity
related.event(
[
'*'
, Related.select('childEventCount').referenceCount('childEvent.id')
], {
childEventCount: Related.gt(1)
}
).order('childEventCount').find().then().catch()
select: childEventCount=referenceCount('childEvent.id')