diff --git a/app.js b/app.js index d252428..6f9a47b 100644 --- a/app.js +++ b/app.js @@ -308,7 +308,7 @@ MongoClient.connect(config.databaseConnectionString, {}, (err, client) => { // add db to app for routes app.db = db; - // add indexing + // run indexing common.runIndexing(app) .then(common.testData(db, app)) .then(app.listen(app.get('port'))) diff --git a/lib/common.js b/lib/common.js index 8f896b2..a989302 100644 --- a/lib/common.js +++ b/lib/common.js @@ -582,6 +582,10 @@ exports.indexOrders = (app, cb) => { // start indexing products and orders exports.runIndexing = (app) => { + if(process.env.NODE_ENV !== 'production'){ + return Promise.resolve(); + } + console.info(colors.yellow('Setting up indexes..')); return Promise.all([