Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More error tracing on the console when bad things happen. Also, bette…

…r support for adding stuff to schema / plugins after initial registration.
  • Loading branch information...
commit 042e971be14f4963703cd9d75cb74f14309167d0 1 parent ed234c6
@JoshuaGross authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 lib/mongoose-subpopulate.js
View
6 lib/mongoose-subpopulate.js
@@ -136,6 +136,7 @@ var wrapSchema = exports.wrapSchema = function wrapSchema (schema) {
try {
return wrapSchema(findOneOrig.call(schema, conditions, fields, options, wrapCallback));
} catch (mongooseError) {
+ console.log(mongooseError.stack);
wrapCallback(mongooseError);
}
};
@@ -231,6 +232,8 @@ var wrapSchema = exports.wrapSchema = function wrapSchema (schema) {
try {
return execOrig.call(schema, postExec);
} catch (mongooseError) {
+ console.log(mongooseError.trace);
+ console.log(mongooseError.stack);
wrapCallback(mongooseError);
}
};
@@ -324,6 +327,9 @@ function wrapModelObject (object) {
for (var i in schema) {
(function (attr) {
wrappedObject.__defineGetter__(attr, function () {
+ // Sometimes the object will have an undefined value, but something is hanging out in object._docs
+ ('undefined' === typeof object[attr] && 'undefined' !== typeof object._doc && 'undefined' !== typeof object._doc[attr]) && (object[attr] = object._doc[attr]);
+
// If our caller is in a Mongoose library, then just return the object attribute directly -
// we don't want to screw with Mongoose internals too much
if (getCallerDetails().file.indexOf('/mongoose/') !== -1) {
Please sign in to comment.
Something went wrong with that request. Please try again.