mongoose-dedupe

1.1.1 • Public • Published

🦄 Mongoose dedupe

Status

Like uniqueness checking but on steroids. Check for individually unique fields, collectively unique queries and unique subdocument values all from within the mongoose Schema.

For Parents

Prop Description
dedupe Use this to lookup a single field value's uniqueness
dedupeWith Runs all properties with this flag in a query

For Subs

Prop Description
distinct Use this to make a sub-document value unique. If merge or accumulate options are not present in sibling options, then it will error on match.
merge Use this to overwrite a sub-document property on match
accumulate Use this to add to a sub-document property on match

Additionally, you can pass an "options" property to the plugin to append query data to each lookup. This is useful if you're using another plugin, such as one that checks the "active" state of a document.

Readme

Keywords

none

Package Sidebar

Install

npm i mongoose-dedupe

Weekly Downloads

4

Version

1.1.1

License

MIT

Unpacked Size

18.5 kB

Total Files

14

Last publish

Collaborators

  • 3merge