Node.js based forum software built for the modern web
closes #735, removed create collection calls
Baris Soner Usaklidfc8aacbaed4
diff --git a/app.js b/app.jsindex 9bc487bc4f..d673bcbccf 100644--- a/app.js+++ b/app.js@@ -74,7 +74,7 @@nconf.set('upload_url', path.join(path.sep, nconf.get('relative_path'), 'uploads', path.sep));nconf.set('base_dir', __dirname);- winston.info('Initializing NodeBB v' + pkg.version + ', on port ' + nconf.get('port') + ', using Redis store at ' + nconf.get('redis:host') + ':' + nconf.get('redis:port') + '.');+ winston.info('Initializing NodeBB v' + pkg.version + ', on port ' + nconf.get('port') + ', using ' + nconf.get('database') +' store at ' + nconf.get(nconf.get('database') + ':host') + ':' + nconf.get(nconf.get('database') + ':port') + '.');winston.info('NodeBB instance bound to: ' + ((nconf.get('bind_address') === "0.0.0.0" || !nconf.get('bind_address')) ? 'Any address (0.0.0.0)' : nconf.get('bind_address')));if (process.env.NODE_ENV === 'development') {diff --git a/src/database/mongo.js b/src/database/mongo.jsindex b0c028a823..fd07ad7f2a 100644--- a/src/database/mongo.js+++ b/src/database/mongo.js@@ -41,45 +41,28 @@winston.error(err.message);process.exit();}- createCollections();+ createIndices();});} else {- createCollections();+ createIndices();}- function createCollections() {- db.createCollection('objects', {w:1}, function(err, collection) {+ function createIndices() {+ db.collection('objects').ensureIndex({_key :1}, {background:true}, function(err) {if(err) {- winston.error('Error creating collection (objects) ' + err.message);- return;+ winston.error('Error creating index ' + err.message);}+ });- if(collection) {- collection.ensureIndex({_key :1}, {background:true}, function(err, name) {- if(err) {- winston.error('Error creating index ' + err.message);- }- });-- collection.ensureIndex({'expireAt':1}, {expireAfterSeconds:0, background:true}, function(err, name) {- if(err) {- winston.error('Error creating index ' + err.message);- }- });+ db.collection('objects').ensureIndex({'expireAt':1}, {expireAfterSeconds:0, background:true}, function(err) {+ if(err) {+ winston.error('Error creating index ' + err.message);}});- db.createCollection('search', {w:1}, function(err, collection) {+ db.collection('search').ensureIndex({content:'text'}, {background:true}, function(err) {if(err) {- winston.error('Error creating collection (search) ' + err.message);- return;- }- if(collection) {- collection.ensureIndex({content:'text'}, {background:true}, function(err, name){- if(err) {- winston.error('Error creating index ' + err.message);- }- });+ winston.error('Error creating index ' + err.message);}});