Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Enhancing support for development envionrment to enable mongoose debu…
Browse files Browse the repository at this point in the history
…g mode so that we can debug db queries

Includes support for environment variable MONGODB_DEBUG
  • Loading branch information
lirantal committed Jul 25, 2015
1 parent e3405d2 commit 0bcadcc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion config/env/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ module.exports = {
options: {
user: '',
pass: ''
}
},
// Enable mongoose debug mode
debug: process.env.MONGODB_DEBUG || false
},
log: {
// Can specify one of 'combined', 'common', 'dev', 'short', 'tiny'
Expand Down
4 changes: 3 additions & 1 deletion config/env/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ module.exports = {
options: {
user: '',
pass: ''
}
},
// Enable mongoose debug mode
debug: process.env.MONGODB_DEBUG || false
},
log: {
// Can specify one of 'combined', 'common', 'dev', 'short', 'tiny'
Expand Down
4 changes: 3 additions & 1 deletion config/env/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ module.exports = {
options: {
user: '',
pass: ''
}
},
// Enable mongoose debug mode
debug: process.env.MONGODB_DEBUG || false
},
port: process.env.PORT || 3001,
app: {
Expand Down
4 changes: 4 additions & 0 deletions config/lib/mongoose.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ module.exports.connect = function(cb) {
console.error(chalk.red('Could not connect to MongoDB!'));
console.log(err);
} else {

// Enabling mongoose debug mode if required
mongoose.set('debug', config.db.debug);

// Load modules
_this.loadModels();

Expand Down

0 comments on commit 0bcadcc

Please sign in to comment.