Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

modifiedFlag not used. Make sure that options is always an object. Ma…

…ke sure that the model object setter gets object._doc
  • Loading branch information...
commit 07ef78f8ac77edc11e6f000e18fd1fdd7c49bc6c 1 parent 1780af7
@JoshuaGross authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/mongoose-subpopulate.js
View
8 lib/mongoose-subpopulate.js
@@ -303,7 +303,6 @@ function wrapModelObject (object) {
var wrappedObject = new (function wrapped () {})();
wrappedObject.mongooseLink = object;
- wrappedObject.__modifiedFlag = false;
wrappedObject.populatedObjects = {};
for (var i in object) {
@@ -364,10 +363,11 @@ function wrapModelObject (object) {
wrappedObject.populatedObjects[value._id] = value;
object.set(attr, value.mongooseLink);
} else {
+ object[attr] = value;
+ object._doc[attr] = value;
object.set(attr, value);
wrappedObject.set(attr, value);
}
- object.__modifiedFlag = true;
});
})(i);
}
@@ -409,8 +409,8 @@ exports.extendMongoose = function (mongooseIn, defineModels) {
mongoose.hasConnected = false;
mongoose.connect = function (url, options, callback) {
- ('function' === typeof options && (callback = options) && (options = undefined));
- connect_orig.call(mongoose, url, options, function (err) {
+ ('function' === typeof options && (callback = options) && (options = {}));
+ connect_orig.call(mongoose, url, options || {}, function (err) {
if (err) {
console.warn('Failed to connect to Mongoose database', err);
process.exit();
Please sign in to comment.
Something went wrong with that request. Please try again.