Skip to content

Commit

Permalink
chore(package): upgrade to mongoose 5
Browse files Browse the repository at this point in the history
  • Loading branch information
Awk34 committed Jun 17, 2018
1 parent fb469cf commit 94673ec
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion templates/app/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"babel-runtime": "^6.18.0",<% if(filters.pug) { %>
"pug": "^2.0.0",<% } %><% if(filters.html) { %>
"ejs": "^2.5.3",<% } %><% if(filters.mongoose) { %>
"mongoose": "^4.13.14",
"mongoose": "^5.1.5",
"bluebird": "^3.3.3",
"connect-mongo": "^2.0.1",<% } %><% if(filters.sequelize) { %>
"sequelize": "^3.23.6",
Expand Down
2 changes: 1 addition & 1 deletion templates/app/protractor.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var config = {

// Setup mongo for tests
var mongoose = require('mongoose');
mongoose.connect(serverConfig.mongo.uri, serverConfig.mongo.options); // Connect to database<% } %>
return mongoose.connect(serverConfig.mongo.uri, serverConfig.mongo.options); // Connect to database<% } %>
}
};

Expand Down
3 changes: 2 additions & 1 deletion templates/app/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import seedDatabaseIfNeeded from './config/seed';<% } %>

<% if (filters.mongoose) { %>
// Connect to MongoDB
mongoose.connect(config.mongo.uri, config.mongo.options);
const mongooseConnectionPromise = mongoose.connect(config.mongo.uri, config.mongo.options);
mongoose.connection.on('error', function(err) {
console.error('MongoDB connection error: ' + err);
process.exit(-1); // eslint-disable-line no-process-exit
Expand Down Expand Up @@ -53,6 +53,7 @@ wsInitPromise
.then(primus => {
app.primus = primus;
})<% if(filters.models) { %>
.then(() => mongooseConnectionPromise)
.then(seedDatabaseIfNeeded)<% } %>
.then(startServer)
.catch(err => {
Expand Down
1 change: 1 addition & 0 deletions templates/app/server/config/environment/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
module.exports = {<% if (filters.mongoose) { %>
// MongoDB connection options
mongo: {
useMongoClient: true,
uri: process.env.MONGODB_URI || 'mongodb://localhost/<%= lodash.slugify(appname) %>-dev'
},<% } if (filters.sequelize) { %>

Expand Down
1 change: 1 addition & 0 deletions templates/app/server/config/environment/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = {

// MongoDB connection options
mongo: {
useMongoClient: true,
uri: process.env.MONGODB_URI
|| process.env.MONGOHQ_URL
|| process.env.OPENSHIFT_MONGODB_DB_URL + process.env.OPENSHIFT_APP_NAME
Expand Down
1 change: 1 addition & 0 deletions templates/app/server/config/environment/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
module.exports = {
// MongoDB connection options
mongo: {
useMongoClient: true,
uri: 'mongodb://localhost/<%= lodash.slugify(appname) %>-test'
},
sequelize: {
Expand Down

0 comments on commit 94673ec

Please sign in to comment.