mongoose-auto-increment
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -7,3 +7,3 @@ var mongoose = require('mongoose'), | ||
exports.initialize = function (connection) { | ||
var counterSchema = new mongoose.Schema({ | ||
counterSchema = new mongoose.Schema({ | ||
model: { | ||
@@ -10,0 +10,0 @@ type: String, |
{ | ||
"name": "mongoose-auto-increment", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "This plugin allows you to auto-increment any field on any mongoose schema that you wish.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -16,4 +16,6 @@ # mongoose-auto-increment | ||
autoIncrement.initialize(mongoose.connection); | ||
var connection = mongoose.createConnection("mongodb://localhost/myDatabase"); | ||
autoIncrement.initialize(connection); | ||
var bookSchema = new mongoose.Schema({ | ||
@@ -27,3 +29,3 @@ author: { type: Schema.Types.ObjectId, ref: 'Author' }, | ||
bookSchema.plugin(autoIncrement.plugin, 'Book'); | ||
mongoose.model('Book', bookSchema); | ||
var Book = connection.model('Book', bookSchema); | ||
@@ -55,2 +57,2 @@ That's it. Now you can create book entities at will and the `_id` field will automatically increment with each new document. | ||
incrementOnUpdate: true | ||
}); | ||
}); |
10029
7
56