{"_id":"@ederzadravec/fastify-mongoose","_rev":"5-75a69b2189ede7d3b6cdd0babdd379a7","name":"@ederzadravec/fastify-mongoose","dist-tags":{"latest":"1.1.3"},"versions":{"1.0.0":{"name":"@ederzadravec/fastify-mongoose","version":"1.0.0","main":"dist/index.js","repository":{"type":"git","url":"git@github.com:ederzadravec/fastify-mongoose.git"},"author":{"name":"Éder Zadravec","email":"ederzadravec@gmail.com"},"license":"MIT","private":false,"scripts":{"build":"tsc --project tsconfig.json "},"dependencies":{"mongoose":"5.11.15"},"devDependencies":{"@types/mongoose":"^5.10.3","@types/node":"^14.14.31","fastify":"^3.12.0","typescript":"^4.2.2"},"description":"## Installation","_id":"@ederzadravec/fastify-mongoose@1.0.0","dist":{"shasum":"4e34946c909e73e0d18ff02b8f25533c2408c005","integrity":"sha512-Au6eieCBN1sP29jdN/RtSxetgNjf9IhdZDIy3QYzpWlQYMvBKVD3qm87yjG9ziCJCpf11FoDTqMnJvTn9/e+0w==","tarball":"https://registry.npmjs.org/@ederzadravec/fastify-mongoose/-/fastify-mongoose-1.0.0.tgz","fileCount":7,"unpackedSize":12612,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgPdIFCRA9TVsSAnZWagAAVP4QAKMj8HSt6wqM2ZyGOXBS\ncMSI/DIu2D9eHoPqTvh/VyXgRV/rNQt9vGBNccV6apHqpLdy60LtPzOgVC/F\nSH2mDl8G/yGnOeZ6Hc4TIMss81+5dCcJLmUp4/ADTrxJLkcr+Ns1NvSUhAPu\nzq1KoQAG6+HELnD/eB/UB+/woz68AF5FJylxC8KOZdMOxqMzp2rqAgoJCf7r\nLLKapkwkbNtp+GQnJ3WbQgFOWEWhHbfyWDk2lKoE+RvvdbsaSyOmCi5Hbbai\ntNE46T/sCUUFB0IKJK8iRhWVpzKr9FMFIr3VNFlNC0oXM53NyNivLsZ1oUlR\nl5eQt7KAtr10FZgig1wangxCED7+8MriSS3nvl0KKS96p8CKRYZ0Qu8oGOhl\n8ELUCaRaPWop+y1eMfHf3U+KIXhw3Sg0t25HkCQ6QINpdu3lJf+i7fw1DhFs\nJsuGbYu9Ynsf+UwpO807EaO02DF/Ikljy8y9fbi6HDVUXX2CcS5VQmxGZF+g\nuJ9eAj2t27PxUzLUxCNVOlw2oHKPEz9eQx/2f7zyI/c9zP62I1VzF2icPp1C\nYHSefawOQuUlaJcz0jUvHXHMC+yvm3nqv4SGjUmBkHrD3cEwjWY5xEIzRATM\n6pyar7HATLOk5ciAebSuzCajGErI1f4UwcoAzthEHXuhvKdVWrhBexlSCaAe\nCgsx\r\n=fPHJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDDYsho+u1jjwfQhVmaiYcIQEK31VVqnKsrqceWb91cGwIgG3Arp7HVmyYEHHSs0OroKlD9CiZL7A4FAm+njsrFIJM="}]},"_npmUser":{"name":"ezadravec","email":"ederzadravec@gmail.com"},"directories":{},"maintainers":[{"name":"ezadravec","email":"ederzadravec@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fastify-mongoose_1.0.0_1614664197464_0.5483280303965501"},"_hasShrinkwrap":false},"1.1.0":{"name":"@ederzadravec/fastify-mongoose","version":"1.1.0","main":"dist/index.js","repository":{"type":"git","url":"git@github.com:ederzadravec/fastify-mongoose.git"},"author":{"name":"Éder Zadravec","email":"ederzadravec@gmail.com"},"license":"MIT","private":false,"scripts":{"build":"tsc --project tsconfig.json "},"dependencies":{"fastify-plugin":"^3.0.0","mongoose":"5.11.15"},"devDependencies":{"@types/mongoose":"^5.10.3","@types/node":"^14.14.31","fastify":"^3.12.0","typescript":"^4.2.2"},"description":"## Installation","_id":"@ederzadravec/fastify-mongoose@1.1.0","dist":{"shasum":"905325b5b333e83c33893580b8e055768c64558e","integrity":"sha512-UxVUuppaAUfcMBpSIsrkUaibSmrmTB2DBehV1EZzfqsl+etSub+TJbQ9ZRnxWzXOq3HRRVuE5Ldu0DCDM6xO4g==","tarball":"https://registry.npmjs.org/@ederzadravec/fastify-mongoose/-/fastify-mongoose-1.1.0.tgz","fileCount":7,"unpackedSize":12666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgP+5oCRA9TVsSAnZWagAA0E8QAJp/N1VwamD0vhPTT8/5\nGjuVF9Hxi1IbnXIzz+8Sphl9PuPn3fsHEeUNU+RVdiq9xCvJmxO/SRrbAEP8\nB0Wtlv6GYYbGELRSrotjSG5mAl8rjG8G9Sy+Qk86HncOheujNcuSTG223wJZ\n5cg62Wq6E8yaB6jrdPAKwkYVzpW1A9GlygU1HT4M7N8l+a7u89qoa/HDLKWr\nFKDmarU0m36hFc7w0nt4CyKQ29TLc8AzXafSou47uPgY/YKI3yDUnu1HgQQx\naYAMWpllTIzPFqewp3VR+/fYP3KUCfsKTWpl1LDXmchZOqvyrh5Wg2U3oBCm\nAWl2BDxONuYy72ySxsjCLLBLoM+ULP7JCwJrPkxdr2oTwdxvYGJMIZRU656u\n/ALdSmoeeIZSBJb8LBqcnQwwiU7U83aX4D9Uy3R4UE+Jn+pxLvwayU/qIlVf\n0vwXMP8ANK3G6kcFnijUVpPnjG4dCZOH1IyPqiXlXqHZf9xE/NVmnHKLvJdH\nP1q1dQBbeepGNZGiKBFv3MgGI22BkwkPd8uLBqsKxzyZAhSiCun2H3TA/dil\nXM0DrmIwopq9DBcChQW/CaRAY1LaNRZqw7l04i2ih+95Ptoa7SimTmWUQsSC\nl/30w3GxZlNKaP6Qx3b1b7qqu712sLhxlqbaB6I1GTzfMLmblhXh64m4PDzD\nlGgW\r\n=0ZQq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDBPmbbZERyhHrsSvnIdHY3B5lQA85Vw96NY0U8ubkQNAIgb78uZb8S8hhp6b1qQU18ZepFw8wH1BRRhob1b+GiIHI="}]},"_npmUser":{"name":"ezadravec","email":"ederzadravec@gmail.com"},"directories":{},"maintainers":[{"name":"ezadravec","email":"ederzadravec@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fastify-mongoose_1.1.0_1614802535962_0.05723574221276784"},"_hasShrinkwrap":false},"1.1.1":{"name":"@ederzadravec/fastify-mongoose","version":"1.1.1","main":"dist/index.js","repository":{"type":"git","url":"git@github.com:ederzadravec/fastify-mongoose.git"},"author":{"name":"Éder Zadravec","email":"ederzadravec@gmail.com"},"license":"MIT","private":false,"scripts":{"build":"tsc --project tsconfig.json "},"dependencies":{"fastify-plugin":"^3.0.0","mongoose":"5.11.15"},"devDependencies":{"@types/mongoose":"^5.10.3","@types/node":"^14.14.31","fastify":"^3.12.0","typescript":"^4.2.2"},"description":"## Installation","_id":"@ederzadravec/fastify-mongoose@1.1.1","dist":{"shasum":"d0cb1abd8a49f3065342e8d78dc90aff21d6a15e","integrity":"sha512-P1t4V9bJOVksIHPmdqdj78eVtl+7VZGw13Ieua1uEfH4hkX6Un+xVibRIs4ZJho4QZwFa1PVcLCK4eeQh7UDzg==","tarball":"https://registry.npmjs.org/@ederzadravec/fastify-mongoose/-/fastify-mongoose-1.1.1.tgz","fileCount":7,"unpackedSize":12784,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgP+7gCRA9TVsSAnZWagAAek0P/iMt1AFpECFaqIYczTM8\nc8w9emsPLtmJK25malclErLSLvu+lVBubUBNJRERR0bOvP1wIXBstZlbDFro\n7GfgXHsNlUMKSX0VDr44f2jyWt5AXHDVzioahjvhQm40I7gmz35fV7Eo+Lnm\n8/A3gWrqLjsbdgzPU8SG1rg8gSF3hz0hZ0QtLcLacihosPj7krJk4uh0z82h\n2PvXn+EruVG9DHPdZMjA5gurHfye1xY159oTtrjl/cBg9T7fYw1X7nS3GJ8c\nfHhs6De6q3RvVNQ91Lt6gO1pIRL5bD8IgrkEPiIvWOmEOhcy7YlxY7b9YOLP\ngWMFLXwNBpw1DfyDll0vrxEepj2BGxiyfn12awnedG+M8rQSjd4FBgiH35wU\nuVhSHbpJPC2WSk5l8/WKkW2JFspGa9zfX5N5J3m88C7rqFw1LuglwamVKuDa\nsphySZPc2ppHSfmiCcSbgBLsd3b/mzVDbf+8Gk8cov9w6OS/vNC4fjmsFpGk\nTQw7jiSSSOzal2HA7899Nhd3hC4qybZkJyPvDBBmnarKpjTeCS0ccIkCB9ga\nIEiPMbCix9aUJKq7CETcjzi8Ih0OwlXwfLwTRqDHvr3wOzPy3+wLfjGCrIBt\nKAtFkk54SUaD7z04HOgRbULu4fXXLujLIhtXyepAmQBfFadmUylTubTq9ZCz\nB8Na\r\n=e992\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCX71cLS+szb6v1EjI3/hFewBSTWPmhP6NWHv6oGWw2UAIgN3W3HAaqz9yjmk2/f/wlcq+c3W8QPFM7JV1W2oNXdC4="}]},"_npmUser":{"name":"ezadravec","email":"ederzadravec@gmail.com"},"directories":{},"maintainers":[{"name":"ezadravec","email":"ederzadravec@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fastify-mongoose_1.1.1_1614802655649_0.980127466546171"},"_hasShrinkwrap":false},"1.1.2":{"name":"@ederzadravec/fastify-mongoose","version":"1.1.2","main":"dist/index.js","repository":{"type":"git","url":"git@github.com:ederzadravec/fastify-mongoose.git"},"author":{"name":"Éder Zadravec","email":"ederzadravec@gmail.com"},"license":"MIT","private":false,"scripts":{"build":"tsc --project tsconfig.json "},"dependencies":{"fastify-plugin":"^3.0.0","mongoose":"5.11.15"},"devDependencies":{"@types/mongoose":"^5.10.3","@types/node":"^14.14.31","fastify":"^3.12.0","typescript":"^4.2.2"},"description":"## Installation","_id":"@ederzadravec/fastify-mongoose@1.1.2","dist":{"shasum":"b29996800ceacbed742ac02e9c322998d8278491","integrity":"sha512-HddXOsIp7b7R8dJg0xESSWgg/LRHK5sLJMCoI05wQfOXDJdhLOgvftREGgKxMjDNN8me0l2hIh1+CbniPkx39g==","tarball":"https://registry.npmjs.org/@ederzadravec/fastify-mongoose/-/fastify-mongoose-1.1.2.tgz","fileCount":7,"unpackedSize":13297,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgyIZ0CRA9TVsSAnZWagAA38wP/0pcNIi+o863eHREPYVr\n29vUCiUaKFccOCgM9MQHxWX57vsGRfEQ8khj+F+7nSpGbUoWcZVimuRdepD4\nRcRS78ksrkL/0Dnwt2DbJKFJ74slCTQglOsZF0VzEdhcpGF2HO3nVYUr9oEC\nQdVRVU0iPRyhiwDp4+C+oS1j+raSEEGrQSz1mReWBYfI6S673g6Rzyfvi0iy\nWc9ajpWhkrE+ekfbjviM+Nise1hR4e7XfbWCa3NCz4RPe1AA20VTyTs2+f2t\nDyE+BiQO7iZoTzqjT98n2hkf/Q6qlKyqPhKHs7knyO4O3J7w6i8Ym2kqVq/G\n7OYcVpqQ0Y0OE+km2/wnBXNmF3OJB//nAN3/eQAwTwwVs8XwdJ1OhKpkJHCV\naiQqO5jrAnSteGjKLSY1yexk3Z3cVe3QoL83Cn7/780MeNUOmBDnq5vyy4Bt\nU4U5COOfRcfaz+e4pcTtI2o08eaVcd1svm7WnEM+s9OY042h0qQOym8EWN9h\neJcPATxxqzFfMCOLqvJlvKsaJhhwXoCgLGgnBz4UmZxJmDjdg/c+/qytUKQY\nA0CuGexnmSL06E6TsfA9Z/iHoWJ2BXwCQiWk/vzTxkzdLdvYBavbNTS3J1XX\nij0XcQtxUI5KUxpDxoe1JJc6zoa81PnbP4/oRnQwZa71M2DTZmhdrTcN3TFf\nHdiZ\r\n=iz67\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDVyhGFkX3TukiP5kjiTqA/rLs1b3R4yz+ZqnX+Y4MA0AIhAMF2d1bIAHXbz2j9YGDAQlKx1UzrtUthrLGM8juBfkWo"}]},"_npmUser":{"name":"ezadravec","email":"ederzadravec@gmail.com"},"directories":{},"maintainers":[{"name":"ezadravec","email":"ederzadravec@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fastify-mongoose_1.1.2_1623754356189_0.8548743966536485"},"_hasShrinkwrap":false},"1.1.3":{"name":"@ederzadravec/fastify-mongoose","version":"1.1.3","main":"dist/index.js","repository":{"type":"git","url":"git@github.com:ederzadravec/fastify-mongoose.git"},"author":{"name":"Éder Zadravec","email":"ederzadravec@gmail.com"},"license":"MIT","private":false,"scripts":{"build":"tsc --project tsconfig.json "},"dependencies":{"fastify-plugin":"^4.5.0","mongoose":"^7.3.0"},"devDependencies":{"@types/mongoose":"^5.11.97","@types/node":"^14.14.31","fastify":"^4.18.0","typescript":"^4.2.2"},"description":"## Installation","_id":"@ederzadravec/fastify-mongoose@1.1.3","dist":{"shasum":"b6c9a53d0970ce80330642b02af6a707f918407a","integrity":"sha512-+XbfHLCBM95p28501JmqPJisCdgJDCZThHQowExqRiED8Z2QVL06ZUOT+bIC7Yxt2uA6H8MNuBbhUNF+elwQBQ==","tarball":"https://registry.npmjs.org/@ederzadravec/fastify-mongoose/-/fastify-mongoose-1.1.3.tgz","fileCount":7,"unpackedSize":13387,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAQ6foTANjdFFpcygd73noepC84kKbGD2rrBzvSj0u8GAiA+Xce4xwIaIazyeb98daVshRb8CbT6xa4AspnaMFJFLA=="}]},"_npmUser":{"name":"ezadravec","email":"ederzadravec@gmail.com"},"directories":{},"maintainers":[{"name":"ezadravec","email":"ederzadravec@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fastify-mongoose_1.1.3_1687266183969_0.43336372466143236"},"_hasShrinkwrap":false}},"time":{"created":"2021-03-02T05:49:57.210Z","1.0.0":"2021-03-02T05:49:57.634Z","modified":"2023-06-20T13:03:04.334Z","1.1.0":"2021-03-03T20:15:36.145Z","1.1.1":"2021-03-03T20:17:35.763Z","1.1.2":"2021-06-15T10:52:36.351Z","1.1.3":"2023-06-20T13:03:04.146Z"},"maintainers":[{"name":"ezadravec","email":"ederzadravec@gmail.com"}],"description":"## Installation","repository":{"type":"git","url":"git@github.com:ederzadravec/fastify-mongoose.git"},"author":{"name":"Éder Zadravec","email":"ederzadravec@gmail.com"},"license":"MIT","readme":"# Fastify MongoDB Plugin using Mongoose and typescript\n\n## Installation\n\n```bash\nyarn add @ederzadravec/fastify-mongoose\n```\n\n## Usage\n\n```typescript\n// ...Other Plugins\nfastify.register(\n  require(\"fastify-mongoose-driver\").plugin,\n  {\n    uri: \"mongodb://admin:pass@localhost:27017/database_name\",\n    settings: {\n      useNewUrlParser: true,\n      config: {\n        autoIndex: true,\n      },\n    },\n    models: [\n      {\n        name: \"posts\",\n        alias: \"Post\",\n        schema: {\n          title: {\n            type: String,\n            required: true,\n          },\n          content: {\n            type: String,\n            required: true,\n          },\n          author: {\n            type: \"ObjectId\",\n            ref: \"Account\",\n          },\n        },\n      },\n      {\n        name: \"accounts\",\n        alias: \"Account\",\n        schema: {\n          username: {\n            type: String,\n          },\n          password: {\n            type: String,\n            select: false,\n            required: true,\n          },\n          email: {\n            type: String,\n            unique: true,\n            required: true,\n          },\n          createdAtUTC: {\n            type: Date,\n            required: true,\n          },\n        },\n        virtualize: (schema) => {\n          schema.virtual(\"posts\", {\n            ref: \"Post\",\n            localKey: \"_id\",\n            foreignKey: \"author\",\n          });\n        },\n      },\n    ],\n    useNameAndAlias: true,\n  },\n  (err) => {\n    if (err) throw err;\n  }\n);\n\nfastify.get(\"/\", (request, reply) => {\n  console.log(fastify.mongoose.instance); // Mongoose ODM instance\n  console.log(fastify.mongoose.Account); // Any models declared are available here\n});\n\n```\n\n## Options\n\n| Option            | Description                                                                                                                                                                                           |\n| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `uri`             | Required, the Unique Resource Identifier to use when connecting to the Database.                                                                                                                      |\n| `settings`        | Optional, the settings to be passed on to the MongoDB Driver as well as the Mongoose-specific options. [Refer here for further info](https://mongoosejs.com/docs/api.html#mongoose_Mongoose-connect). |\n| `models`          | Optional, any models to be declared and injected under `fastify.mongoose`                                                                                                                             |\n| `useNameAndAlias` | Optional, declares models using `mongoose.model(alias, schema, name)` instead of `mongoose.model(name, schema)`                                                                                       |\n\nAny models declared should follow the following format:\n\n```javascript\n{\n  name: \"profiles\", // Required, should match name of model in database\n  alias: \"Profile\", // Optional, an alias to inject the model as\n  schema: schemaDefinition // Required, should match schema of model in database,\n  class: classDefinition // Optional, should be an ES6 class wrapper for the model\n}\n```\n\nThe `schemaDefinition` variable should be created according to the [Mongoose Model Specification](https://mongoosejs.com/docs/schematypes.html).\nThe `classDefinition` variable should be created according to the [Mongoose Class Specification](https://mongoosejs.com/docs/4.x/docs/advanced_schemas.html).\n\n## Refer\n\nthis library was based on [fastify-mongoose](https://github.com/alex-ppg/fastify-mongoose) of [Alexander Papageorgiou](https://github.com/alex-ppg)\n\nI rewrote in typescript using your repository as a base\n","readmeFilename":"readme.md"}