findOneOrCreate
Promise-based plugin for Mongoose that defines a "findOneOrCreate" static method.
Useful for finding a document, with support for creating it if doesn't exist already.
Install
$ npm install --save mongoose-findoneorcreate
Usage
;;; BookSchema; const model = mongoose; const book = await model;
Related
- findAnyoneOrCreate - Promise-based plugin for Mongoose that defines a "findAnyoneOrCreate" static method.
License
MIT © Fabio Spampinato