added error checking to collection index creation

v1.18.x
Baris Soner Usakli 11 years ago
parent 39b70a9e09
commit c698af17ae

@ -27,11 +27,17 @@
db.createCollection('objects', function(err, collection) {
collection.ensureIndex({_key :1}, {background:true}, function(err, name){
if(err) {
winston.error("Error creating index " + err.message);
}
});
if(err) {
winston.error("Error creating collection " + err.message);
return;
}
if(collection) {
collection.ensureIndex({_key :1, setName:1}, {background:true}, function(err, name){
if(err) {
winston.error("Error creating index " + err.message);
}
});
}
});
callback(err);

@ -17,7 +17,9 @@ var db = require('./database'),
(function(ThreadTools) {
ThreadTools.exists = function(tid, callback) {
db.isSetMember('topics:tid', tid, function(err, ismember) {
if (err) {
callback(false);
}

Loading…
Cancel
Save