UNPKG

geoserver

Version:
29 lines (22 loc) 685 B
// Generated by CoffeeScript 1.10.0 var EventEmitter, Mongo, MongoClient, inherits; EventEmitter = require('events').EventEmitter; MongoClient = require('mongodb').MongoClient; inherits = require('util').inherits; Mongo = function(uri) { EventEmitter.call(this); new MongoClient.connect(uri, (function(_this) { return function(err, database) { console.log('MongoDB connection opened'); if (err) { throw err; } _this.db = database; _this.grenser = _this.db.collection('grenser'); return _this.emit('ready'); }; })(this)); return this; }; inherits(Mongo, EventEmitter); module.exports = new Mongo(process.env.MONGO_URI);