Permalink
Browse files

fixed; calling docArray.toObject() containing null

fixes the call to docArray.inspect() as well
  • Loading branch information...
1 parent 639f9ae commit 831c324585a6ff014538c84ddd6020c61e55aa01 @aheckmann aheckmann committed Oct 13, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/types/documentarray.js
@@ -93,7 +93,7 @@ MongooseDocumentArray.prototype.id = function (id) {
MongooseDocumentArray.prototype.toObject = function () {
return this.map(function (doc) {
- return doc.toObject();
+ return doc && doc.toObject() || null;
});
};
@@ -105,7 +105,7 @@ MongooseDocumentArray.prototype.toObject = function () {
MongooseDocumentArray.prototype.inspect = function () {
return '[' + this.map(function (doc) {
- return doc.inspect();
+ return doc && doc.inspect() || 'null';
}).join('\n') + ']';
};

0 comments on commit 831c324

Please sign in to comment.