closes #735, removed create collection calls

v1.18.x
Baris Soner Usakli 11 years ago
parent 8c04e8e56c
commit dfc8aacbae

@ -74,7 +74,7 @@
nconf.set('upload_url', path.join(path.sep, nconf.get('relative_path'), 'uploads', path.sep)); nconf.set('upload_url', path.join(path.sep, nconf.get('relative_path'), 'uploads', path.sep));
nconf.set('base_dir', __dirname); 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'))); 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') { if (process.env.NODE_ENV === 'development') {

@ -41,45 +41,28 @@
winston.error(err.message); winston.error(err.message);
process.exit(); process.exit();
} }
createCollections(); createIndices();
}); });
} else { } else {
createCollections(); createIndices();
} }
function createCollections() { function createIndices() {
db.createCollection('objects', {w:1}, function(err, collection) { db.collection('objects').ensureIndex({_key :1}, {background:true}, function(err) {
if(err) { if(err) {
winston.error('Error creating collection (objects) ' + err.message); winston.error('Error creating index ' + err.message);
return;
} }
});
if(collection) { db.collection('objects').ensureIndex({'expireAt':1}, {expireAfterSeconds:0, background:true}, function(err) {
collection.ensureIndex({_key :1}, {background:true}, function(err, name) { if(err) {
if(err) { winston.error('Error creating index ' + err.message);
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.createCollection('search', {w:1}, function(err, collection) { db.collection('search').ensureIndex({content:'text'}, {background:true}, function(err) {
if(err) { if(err) {
winston.error('Error creating collection (search) ' + err.message); winston.error('Error creating index ' + err.message);
return;
}
if(collection) {
collection.ensureIndex({content:'text'}, {background:true}, function(err, name){
if(err) {
winston.error('Error creating index ' + err.message);
}
});
} }
}); });

Loading…
Cancel
Save