mirror of
				https://github.com/KevinMidboe/zoff.git
				synced 2025-10-29 18:00:23 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			17 lines
		
	
	
		
			487 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			487 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
var path = require('path');
 | 
						|
var mongo_config = require(path.join(path.join(__dirname, '../config/'), 'mongo_config.js'));
 | 
						|
var mongojs = require('mongojs');
 | 
						|
var db = mongojs(mongo_config.config);
 | 
						|
 | 
						|
db.collection("chat_logs").createIndex({ "createdAt": 1 }, { expireAfterSeconds: 600 });
 | 
						|
 | 
						|
db.on('connected', function(err) {
 | 
						|
    console.log("connected");
 | 
						|
})
 | 
						|
 | 
						|
db.on('error',function(err) {
 | 
						|
    console.log("\n" + new Date().toString() + "\n Database error: ", err);
 | 
						|
});
 | 
						|
 | 
						|
module.exports = db;
 |