2.0.3 • Published 7 years ago

related-reference-counter v2.0.3

Weekly downloads
29
License
MIT
Repository
github
Last release
7 years ago

related-reference-counter

Count references items on your entities.

npm Travis node

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')