mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Add linting and unused cleanup
This commit is contained in:
@@ -17,68 +17,113 @@ var connected_db = mongojs(
|
||||
);
|
||||
var ObjectId = mongojs.ObjectId;
|
||||
|
||||
db.collection("chat_logs").createIndex(
|
||||
{ createdAt: 1 },
|
||||
{ expireAfterSeconds: 600 },
|
||||
function() {}
|
||||
db.collection("chat_logs").createIndex({
|
||||
createdAt: 1
|
||||
}, {
|
||||
expireAfterSeconds: 600
|
||||
},
|
||||
function () {}
|
||||
);
|
||||
db.collection("timeout_api").createIndex(
|
||||
{ createdAt: 1 },
|
||||
{ expireAfterSeconds: 120 },
|
||||
function() {}
|
||||
db.collection("timeout_api").createIndex({
|
||||
createdAt: 1
|
||||
}, {
|
||||
expireAfterSeconds: 120
|
||||
},
|
||||
function () {}
|
||||
);
|
||||
db.collection("api_links").createIndex(
|
||||
{ createdAt: 1 },
|
||||
{ expireAfterSeconds: 86400 },
|
||||
function() {}
|
||||
db.collection("api_links").createIndex({
|
||||
createdAt: 1
|
||||
}, {
|
||||
expireAfterSeconds: 86400
|
||||
},
|
||||
function () {}
|
||||
);
|
||||
db.on("connected", function(err) {
|
||||
db.on("connected", function (err) {
|
||||
console.log("connected");
|
||||
});
|
||||
|
||||
db.on("error", function(err) {
|
||||
db.on("error", function (err) {
|
||||
console.log("\n" + new Date().toString() + "\n Database error: ", err);
|
||||
});
|
||||
|
||||
db.on("error", function(err) {
|
||||
db.on("error", function (err) {
|
||||
console.log("\n" + new Date().toString() + "\n Database error: ", err);
|
||||
});
|
||||
|
||||
/* Resetting usernames, and connected users */
|
||||
db.collection("unique_ids").update(
|
||||
{ _id: "unique_ids" },
|
||||
{ $set: { unique_ids: [] } },
|
||||
{ multi: true, upsert: true },
|
||||
function(err, docs) {}
|
||||
db.collection("unique_ids").update({
|
||||
_id: "unique_ids"
|
||||
}, {
|
||||
$set: {
|
||||
unique_ids: []
|
||||
}
|
||||
}, {
|
||||
multi: true,
|
||||
upsert: true
|
||||
},
|
||||
function (err, docs) {}
|
||||
);
|
||||
db.collection("user_names").remove(
|
||||
{ guid: { $exists: true } },
|
||||
{ multi: true, upsert: true },
|
||||
function(err, docs) {}
|
||||
db.collection("user_names").remove({
|
||||
guid: {
|
||||
$exists: true
|
||||
}
|
||||
}, {
|
||||
multi: true,
|
||||
upsert: true
|
||||
},
|
||||
function (err, docs) {}
|
||||
);
|
||||
db.collection("user_names").update(
|
||||
{ _id: "all_names" },
|
||||
{ $set: { names: [] } },
|
||||
{ multi: true, upsert: true },
|
||||
function(err, docs) {}
|
||||
db.collection("user_names").update({
|
||||
_id: "all_names"
|
||||
}, {
|
||||
$set: {
|
||||
names: []
|
||||
}
|
||||
}, {
|
||||
multi: true,
|
||||
upsert: true
|
||||
},
|
||||
function (err, docs) {}
|
||||
);
|
||||
db.collection("connected_users").update(
|
||||
{ users: { $exists: true } },
|
||||
{ $set: { users: [] } },
|
||||
{ multi: true, upsert: true },
|
||||
function(err, docs) {}
|
||||
db.collection("connected_users").update({
|
||||
users: {
|
||||
$exists: true
|
||||
}
|
||||
}, {
|
||||
$set: {
|
||||
users: []
|
||||
}
|
||||
}, {
|
||||
multi: true,
|
||||
upsert: true
|
||||
},
|
||||
function (err, docs) {}
|
||||
);
|
||||
db.collection("connected_users").update(
|
||||
{ _id: "total_users" },
|
||||
{ $set: { total_users: [] } },
|
||||
{ multi: true, upsert: true },
|
||||
function(err, docs) {}
|
||||
db.collection("connected_users").update({
|
||||
_id: "total_users"
|
||||
}, {
|
||||
$set: {
|
||||
total_users: []
|
||||
}
|
||||
}, {
|
||||
multi: true,
|
||||
upsert: true
|
||||
},
|
||||
function (err, docs) {}
|
||||
);
|
||||
db.collection("frontpage_lists").update(
|
||||
{ viewers: { $ne: 0 } },
|
||||
{ $set: { viewers: 0 } },
|
||||
{ multi: true, upsert: true },
|
||||
function(err, docs) {}
|
||||
db.collection("frontpage_lists").update({
|
||||
viewers: {
|
||||
$ne: 0
|
||||
}
|
||||
}, {
|
||||
$set: {
|
||||
viewers: 0
|
||||
}
|
||||
}, {
|
||||
multi: true,
|
||||
upsert: true
|
||||
},
|
||||
function (err, docs) {}
|
||||
);
|
||||
|
||||
module.exports = db;
|
||||
module.exports = db;
|
||||
Reference in New Issue
Block a user