related-reference-counter

2.0.3 • Public • Published

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

Package Sidebar

Install

npm i related-reference-counter

Weekly Downloads

1

Version

2.0.3

License

MIT

Last publish

Collaborators

  • ee