Workaround for occasional crash in scrubber

This commit is contained in:
DallonF
2012-08-22 11:41:28 -07:00
parent fdb4b9d494
commit a1f6d605d4
2 changed files with 14 additions and 9 deletions

View File

@@ -199,7 +199,7 @@ Store.prototype.scrubQuery = function (query) {
// private mongo ids can be anywhere in a query object
// walk the object recursively replacing id with _id
// NOTE: if you are implementing your own Store,
// you probably wont need to do this if you want sotre ids
// you probably wont need to do this if you want store ids
// as 'id'
if(query.id && typeof query.id === 'object') {
@@ -207,13 +207,18 @@ Store.prototype.scrubQuery = function (query) {
delete query.id;
}
scrub(query, function (obj, key, parent, type) {
// find any value using _id
if(key === 'id' && parent.id) {
parent._id = parent.id;
delete parent.id;
}
});
try {
scrub(query, function (obj, key, parent, type) {
// find any value using _id
if(key === 'id' && parent.id) {
parent._id = parent.id;
delete parent.id;
}
});
} catch(ex) {
debug(ex);
}
};
/**

View File

@@ -106,7 +106,7 @@ function Server(options) {
server.router = router;
server.resources = resourcesInstances;
router.route(req, res);
router.route(req, res);
});
}