combine.fm/config/db.js

14 lines
470 B
JavaScript
Raw Normal View History

2015-08-20 23:22:57 +01:00
import mongodb from 'mongodb-promisified';
const MongoClient = mongodb().MongoClient;
import debuglog from 'debug';
const debug = debuglog('match.audio');
2015-06-03 21:45:54 -07:00
const uristring = process.env.MONGOLAB_URI || process.env.MONGOHQ_URL || 'mongodb://localhost:27017/match-audio';
2015-08-20 23:22:57 +01:00
export default function*() {
2015-06-03 21:45:54 -07:00
const client = yield MongoClient.connect(uristring);
debug('Successfully connected to Mongodb');
client.matches = client.collection('matches');
return client;
};