You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
1.6 KiB
JavaScript

11 years ago
(function(module) {
'use strict';
11 years ago
var mongodb = require('mongodb')
mongoClient = mongodb.MongoClient,
11 years ago
winston = require('winston'),
nconf = require('nconf'),
11 years ago
express = require('express'),
mongoStore = require('connect-mongo')(express);
mongoHost = nconf.get('mongo:host');
11 years ago
11 years ago
// 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();
}
});
11 years ago
// look up how its done in mongo
/*if (nconf.get('mongo:password')) {
redisClient.auth(nconf.get('mongo:password'));
}
11 years ago
*/
// TODO: fill out settings.db
module.sessionStore = new mongoStore({
11 years ago
db: settings.db
});
11 years ago
//
// 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));