JSPM

mongoose-populate-options

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 130
  • Score
    100M100P100Q89071F
  • License MIT

A Mongoose plugin for applying query options to every layer of population.

Package Exports

  • mongoose-populate-options

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mongoose-populate-options) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

mongoose-populate-options

Build Status

A Mongoose plugin for applying query options to every layer of population.

Getting Started

Installing

npm install mongoose-populate-options --save

Usage

MyModel.find()
  .populate('friends')
  .populate('teachers')
  .setPopulateOptions({ limit: 2 });

This will set mognoose options on the two populate calls, as if you'd defined options inline on each one.

Note: Just like setOptions, order matters. setPopulateOptions will affect all populate calls before it, but not after it. Options from setPopulateOptions will overwrite options that have alread been set.

Note: This method does not set options on the query itself.

Contributing

Running the tests

npm test

Style

./node_modules/.bin/eslint .

Author

Makinde Adeagbo

License

This project is licensed under the MIT License - see the LICENSE file for details