Skip to content

Commit

Permalink
Check mongodb version >=2.6.0 for aggregate queries (agenda#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
joeframbach authored Oct 14, 2016
1 parent 8ef3329 commit 023e6c2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ A Dashboard for [Agenda](https://github.com/rschmukler/agenda)
npm install --save agendash
```

*Note*: `Agendash` requires mongodb version >2.6.0 to perform the needed aggregate queries. This is your mongo database version, not your node package version! To check your database version, connect to mongo and run `db.version()`.

### Standalone usage

Agendash comes with a standalone Express app which you can use like this:
Expand Down
6 changes: 6 additions & 0 deletions lib/agendash.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var async = require('async')
var ObjectId = require('mongodb').ObjectId
var semver = require('semver')

module.exports = function (agenda, options) {
options = options || {}
Expand All @@ -13,6 +14,11 @@ module.exports = function (agenda, options) {
console.warn('Agendash indexes might not exist. Performance may decrease.')
}
})
agenda._mdb.admin().serverInfo().then(function (serverInfo) {
if (!semver.satisfies(serverInfo.version, '>=2.6.0')) {
console.warn('Agendash requires mongodb version >=2.6.0.')
}
})
})

return {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"body-parser": "^1.15.0",
"commander": "^2.9.0",
"express": "^4.0.0",
"mongodb": "^2.0.0"
"mongodb": "^2.0.0",
"semver": "^5.3.0"
}
}
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ resolve-from@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57"

semver@^5.1.0:
semver@^5.1.0, semver@^5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"

Expand Down

0 comments on commit 023e6c2

Please sign in to comment.