You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This deep clone method may cause infinite recursion on Mongoose objects in version 2.7.1 of mongoose when trying to log the mongoose object as meta. Maybe prevent this by adding a maximum depth to this function?
common.clone = function (obj, lvl) {
lvl = lvl || 1;
var clone = {};
if (lvl > MAX_DEPTH) {
return clone;
}
for (var i in obj) {
clone[i] = obj[i] instanceof Object ? common.clone(obj[i], lvl+1) : obj[i];
}
return clone;
};
The text was updated successfully, but these errors were encountered:
this one's very annoying, however.. a 'fix' for apps using the log function is to call .toObject() on the mongoose instance. that would also work inside of here.. if toObject exists, call that
This deep clone method may cause infinite recursion on Mongoose objects in version 2.7.1 of mongoose when trying to log the mongoose object as meta. Maybe prevent this by adding a maximum depth to this function?
The text was updated successfully, but these errors were encountered: