10 minutes chat history, limit of 20 messages

This commit is contained in:
Kasper Rynning-Tønnesen
2017-10-13 13:47:13 +02:00
parent 3b50d84af8
commit d8c1abfba9
7 changed files with 60 additions and 6 deletions

View File

@@ -2,6 +2,8 @@ var mongo_db_cred = {config: 'mydb'};
var mongojs = require('mongojs');
var db = mongojs(mongo_db_cred.config);
db.collection("chat_logs").createIndex({ "createdAt": 1 }, { expireAfterSeconds: 600 });
db.on('connected', function(err) {
console.log("connected");
})