diff --git a/lib/model.js b/lib/model.js index faafe747e30..2bfbc9f426b 100644 --- a/lib/model.js +++ b/lib/model.js @@ -2678,7 +2678,6 @@ Model.compile = function compile (name, schema, collectionName, connection, base } model.schema = model.prototype.schema; - model.options = model.prototype.options; model.collection = model.prototype.collection; return model; diff --git a/lib/schema.js b/lib/schema.js index 999395cd120..7f6cad8919d 100644 --- a/lib/schema.js +++ b/lib/schema.js @@ -292,7 +292,6 @@ reserved.init = reserved.isNew = reserved.errors = reserved.schema = -reserved.options = reserved.modelName = reserved.collection = reserved.toObject = diff --git a/test/query.middleware.test.js b/test/query.middleware.test.js index 9bde4d31e30..279a1c0279c 100644 --- a/test/query.middleware.test.js +++ b/test/query.middleware.test.js @@ -13,7 +13,8 @@ describe('query middleware', function() { schema = new Schema({ title: String, author: String, - publisher: { type: Schema.ObjectId, ref: 'gh-2138-1' } + publisher: { type: Schema.ObjectId, ref: 'gh-2138-1' }, + options: String }); var publisherSchema = new Schema({ @@ -42,7 +43,8 @@ describe('query middleware', function() { var doc = { title: 'Professional AngularJS', author: 'Val', - publisher: publisher._id + publisher: publisher._id, + options: 'bacon' }; Author.create(doc, function(error) { @@ -78,6 +80,7 @@ describe('query middleware', function() { schema.post('find', function(results, next) { assert.equal(1, results.length); assert.equal('Val', results[0].author); + assert.equal('bacon', results[0].options); ++postCount; next(); }); diff --git a/test/schema.test.js b/test/schema.test.js index 983eb2a9bce..f0e415c0d32 100644 --- a/test/schema.test.js +++ b/test/schema.test.js @@ -1312,12 +1312,6 @@ describe('schema', function(){ }); }, /`on` may not be used as a schema pathname/); - assert.throws(function(){ - new Schema({ - options: String - }); - }, /`options` may not be used as a schema pathname/); - assert.throws(function(){ new Schema({ collection: String