mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-31 11:50:08 +01:00
closes #735, removed create collection calls
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
winston.error('Error creating index ' + err.message);
|
||||
}
|
||||
});
|
||||
|
||||
db.createCollection('search', {w:1}, function(err, collection) {
|
||||
db.collection('objects').ensureIndex({'expireAt':1}, {expireAfterSeconds:0, background:true}, function(err) {
|
||||
if(err) {
|
||||
winston.error('Error creating collection (search) ' + err.message);
|
||||
return;
|
||||
winston.error('Error creating index ' + err.message);
|
||||
}
|
||||
if(collection) {
|
||||
collection.ensureIndex({content:'text'}, {background:true}, function(err, name){
|
||||
if(err) {
|
||||
winston.error('Error creating index ' + err.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
db.collection('search').ensureIndex({content:'text'}, {background:true}, function(err) {
|
||||
if(err) {
|
||||
winston.error('Error creating index ' + err.message);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user