Skip to content

Commit 94673ec

Browse files
committed
chore(package): upgrade to mongoose 5
1 parent fb469cf commit 94673ec

File tree

6 files changed

+7
-3
lines changed

6 files changed

+7
-3
lines changed

Diff for: templates/app/_package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"babel-runtime": "^6.18.0",<% if(filters.pug) { %>
3030
"pug": "^2.0.0",<% } %><% if(filters.html) { %>
3131
"ejs": "^2.5.3",<% } %><% if(filters.mongoose) { %>
32-
"mongoose": "^4.13.14",
32+
"mongoose": "^5.1.5",
3333
"bluebird": "^3.3.3",
3434
"connect-mongo": "^2.0.1",<% } %><% if(filters.sequelize) { %>
3535
"sequelize": "^3.23.6",

Diff for: templates/app/protractor.conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ var config = {
9090

9191
// Setup mongo for tests
9292
var mongoose = require('mongoose');
93-
mongoose.connect(serverConfig.mongo.uri, serverConfig.mongo.options); // Connect to database<% } %>
93+
return mongoose.connect(serverConfig.mongo.uri, serverConfig.mongo.options); // Connect to database<% } %>
9494
}
9595
};
9696

Diff for: templates/app/server/app.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import seedDatabaseIfNeeded from './config/seed';<% } %>
1616

1717
<% if (filters.mongoose) { %>
1818
// Connect to MongoDB
19-
mongoose.connect(config.mongo.uri, config.mongo.options);
19+
const mongooseConnectionPromise = mongoose.connect(config.mongo.uri, config.mongo.options);
2020
mongoose.connection.on('error', function(err) {
2121
console.error('MongoDB connection error: ' + err);
2222
process.exit(-1); // eslint-disable-line no-process-exit
@@ -53,6 +53,7 @@ wsInitPromise
5353
.then(primus => {
5454
app.primus = primus;
5555
})<% if(filters.models) { %>
56+
.then(() => mongooseConnectionPromise)
5657
.then(seedDatabaseIfNeeded)<% } %>
5758
.then(startServer)
5859
.catch(err => {

Diff for: templates/app/server/config/environment/development.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
module.exports = {<% if (filters.mongoose) { %>
77
// MongoDB connection options
88
mongo: {
9+
useMongoClient: true,
910
uri: process.env.MONGODB_URI || 'mongodb://localhost/<%= lodash.slugify(appname) %>-dev'
1011
},<% } if (filters.sequelize) { %>
1112

Diff for: templates/app/server/config/environment/production.js

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module.exports = {
1616

1717
// MongoDB connection options
1818
mongo: {
19+
useMongoClient: true,
1920
uri: process.env.MONGODB_URI
2021
|| process.env.MONGOHQ_URL
2122
|| process.env.OPENSHIFT_MONGODB_DB_URL + process.env.OPENSHIFT_APP_NAME

Diff for: templates/app/server/config/environment/test.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
module.exports = {
77
// MongoDB connection options
88
mongo: {
9+
useMongoClient: true,
910
uri: 'mongodb://localhost/<%= lodash.slugify(appname) %>-test'
1011
},
1112
sequelize: {

0 commit comments

Comments
 (0)