mongo-projection-from-keys
Generate MongoDB projection from list of keys to include / exclude
Install
$ yarn add mongo-projection-from-keys
Usage
const mongoProjectionFromKeys = ; ; // => '{email: 1, username: 1, _id: 0}'
API
mongoProjectionFromKeys({include, exclude})
{include, exclude}
Type: object
Options object with include
and exclude
arrays.
exclude
has higher priority.
License
MIT © Vlad Holubiev