mongoose-plugin-autoinc-fix
Advanced tools
Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "mongoose-plugin-autoinc-fix", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "==fix-bug==This plugin allows you to auto-increment any field on any mongoose schema that you wish (forked mongoose-auto-increment in 2018).", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -1,2 +0,2 @@ | ||
# mongoose-plugin-autoinc | ||
# mongoose-plugin-autoinc-fix | ||
[](https://www.npmjs.com/package/mongoose-plugin-autoinc) | ||
@@ -27,4 +27,6 @@ [](https://codecov.io/github/nodkz/mongoose-plugin-autoinc) | ||
> npm install mongoose-plugin-autoinc | ||
> npm install mongoose-plugin-autoinc-fix | ||
> yarn add mongoose-plugin-autoinc-fix | ||
Once you have the plugin installed it is very simple to use. Just pass `autoIncrement` to the `plugin()` function on your schema. | ||
@@ -36,5 +38,5 @@ | ||
import mongoose from 'mongoose'; | ||
import { autoIncrement } from 'mongoose-plugin-autoinc'; | ||
import { autoIncrement } from 'mongoose-plugin-autoinc-fix'; | ||
const connection = mongoose.createConnection("mongodb://localhost/myDatabase"); | ||
mongoose.connect("mongodb://localhost/myDatabase"); | ||
@@ -49,3 +51,3 @@ const BookSchema = new mongoose.Schema({ | ||
BookSchema.plugin(autoIncrement, 'Book'); | ||
const Book = connection.model('Book', BookSchema); | ||
const Book = mongoose.model('Book', BookSchema); | ||
```` | ||
@@ -52,0 +54,0 @@ |
29980
143