| 
									
										
										
										
											2013-12-02 16:19:30 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | (function(module) { | 
					
						
							|  |  |  | 	'use strict'; | 
					
						
							| 
									
										
										
										
											2013-12-02 22:48:32 -05:00
										 |  |  | 	var mongodb = require('mongodb') | 
					
						
							|  |  |  | 		mongoClient = mongodb.MongoClient, | 
					
						
							| 
									
										
										
										
											2013-12-02 16:19:30 -05:00
										 |  |  | 		winston = require('winston'), | 
					
						
							|  |  |  | 		nconf = require('nconf'), | 
					
						
							| 
									
										
										
										
											2013-12-02 22:48:32 -05:00
										 |  |  | 		express = require('express'), | 
					
						
							|  |  |  | 		mongoStore = require('connect-mongo')(express); | 
					
						
							|  |  |  | 		mongoHost = nconf.get('mongo:host'); | 
					
						
							| 
									
										
										
										
											2013-12-02 16:19:30 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-02 22:48:32 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// mongoClient.connect("mongodb://localhost:27017/exampleDb", function(err, db) {
 | 
					
						
							|  |  |  | 	mongoClient.connect('mongodb://' + mongoHost + ':' + nconf.get('mongo:port') + '/' + nconf.get('mongo:database'), function(err, db) { | 
					
						
							|  |  |  | 		if(err) { | 
					
						
							|  |  |  | 			winston.error("NodeBB could not connect to your Mongo database. Mongo returned the following error: " + error.message); | 
					
						
							|  |  |  | 			process.exit(); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}); | 
					
						
							| 
									
										
										
										
											2013-12-02 16:19:30 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// look up how its done in mongo
 | 
					
						
							|  |  |  | 	/*if (nconf.get('mongo:password')) { | 
					
						
							|  |  |  | 		redisClient.auth(nconf.get('mongo:password')); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2013-12-02 22:48:32 -05:00
										 |  |  | 	*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// TODO: fill out settings.db
 | 
					
						
							|  |  |  | 	module.sessionStore = new mongoStore({ | 
					
						
							| 
									
										
										
										
											2013-12-02 22:50:39 -05:00
										 |  |  | 		db: settings.db | 
					
						
							|  |  |  | 	}); | 
					
						
							| 
									
										
										
										
											2013-12-02 16:19:30 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	//
 | 
					
						
							|  |  |  | 	// Exported functions
 | 
					
						
							|  |  |  | 	//
 | 
					
						
							|  |  |  | 	module.getFileName = function(callback) { | 
					
						
							|  |  |  | 		// TODO : get mongodb filename
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	module.setObject = function(key, data, callback) { | 
					
						
							|  |  |  | 		// TODO : implement in mongo
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	module.setObjectField = function(key, field, callback) { | 
					
						
							|  |  |  | 		// TODO : implement in mongo
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	module.getObject = function(key, callback) { | 
					
						
							|  |  |  | 		// TODO : implement in mongo
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	module.getObjectField = function(key, field, callback) { | 
					
						
							|  |  |  | 		// TODO : implement in mongo
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	module.getObjectFields = function(key, fields, callback) { | 
					
						
							|  |  |  | 		// TODO : implement in mongo
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	module.deleteObjectField = function(key, field, callback) { | 
					
						
							|  |  |  | 		// TODO : implement in mongo
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	module.incrObjectField = function(key, field, value, callback) { | 
					
						
							|  |  |  | 		// TODO : implement in mongo
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }(exports)); | 
					
						
							|  |  |  | 
 |