diff --git a/README.md b/README.md index 8846891..c00fa82 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ The \_\_v field is used by mongoose to help with concurrent updates, this is not The rollback model is stored in a seperate collection, the name is specified in the plugin options, \_hist is appened to the name. It is recommended you use the same collection name as the Schema you intend to keep history for. -Make sure to supply your connection name as an option (conn: mongodb://host/db} to the options field. Sometimes it can work without, most of the times no. +Make sure to supply your connection name as an option (conn: mongodb://host/db} to the options field if you intend to use a seperate connection!. DELETES CASCADE! Delete your model => history is removed. I trust that you know what youre doing. diff --git a/mongoose-rollback.js b/mongoose-rollback.js index 7c71ac5..57d70c1 100644 --- a/mongoose-rollback.js +++ b/mongoose-rollback.js @@ -1,5 +1,4 @@ var RollbackSchema = require('./models/rollback.js'); -var mongoose = require('mongoose'); var buildRollbackMethods = require('./lib/methods.js'); var buildSaveMethods = require('./lib/save.js'); var buildStaticFunctions = require('./lib/statics.js'); @@ -17,7 +16,8 @@ function rollbackPlugin (schema, options) { }) // assumes connection happens before plugin or something? not sure but yea.. - var conn = mongoose; // default connection in mongoose object; + var mongoose = require('mongoose'); + var conn = mongoose; // add index on version field if (options && options.index) { diff --git a/package.json b/package.json index c7f6166..0e76236 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mongoose-rollback", - "version": "1.1.1", + "version": "1.1.2", "description": "mongoose rollback machine", "main": "mongoose-rollback.js", "dependencies": {