Skip to content
This repository has been archived by the owner on May 3, 2023. It is now read-only.

Commit

Permalink
fixes #16 and bump to 0.0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
iolo committed Sep 4, 2014
1 parent 93e06a0 commit 301ae95
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions libs/mongoose_q.js
Expand Up @@ -103,12 +103,23 @@ function mongooseQ(mongoose, options) {
// XXX: simple but ugly workaround to access Aggregate prototype.
// see https://github.com/iolo/mongoose-q/issues/6 and
// https://github.com/LearnBoost/mongoose/issues/1910
var Aggregate;
try {
qualify(require(__dirname + '/../node_modules/mongoose/lib/aggregate').prototype,
MONGOOSE_AGGREGATE_METHODS, mapper, spread);
// outside of mongoose-q
// https://github.com/iolo/mongoose-q/issues/16
Aggregate = require(__dirname + '/../../mongoose/lib/aggregate');
} catch (e) {
console.error('***ignore*** failed to load Aggregate', e);
try {
// inside of mongoose-q itself...
Aggregate = require(__dirname + '/../node_modules/mongoose/lib/aggregate');
} catch (e) {
// ignore!
console.error(e);
console.error('***ignore*** failed to load Aggregate', e);
}
}
if (Aggregate && Aggregate.prototype) {
qualify(Aggregate.prototype, MONGOOSE_AGGREGATE_METHODS, mapper, spread);
}

mongoose['__q_applied_' + applied] = true;
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "mongoose-q",
"version": "0.0.11",
"version": "0.0.12",
"description": "kriskowal's Q support for mongoose",
"author": "Dongsu Jang <iolothebard@gmail.com>",
"repository": {
Expand Down

0 comments on commit 301ae95

Please sign in to comment.