// config/database.js
/*
module.exports = {
	// looks example like mongodb://<user>:<pass>@mongo.onmodulus.net:27017/Mikha4ot
    'url' : process.env.MODULUS_SMSL_FRONTEND_URI

};
*/
// grab the things we need
var mongoose = require('mongoose');

var mongoAddress = process.env.MONGO_ADDRESS_SMSL_FRONTEND; // e.g. 127.0.0.1
var mongoAddressPort = process.env.MONGO_ADDRESS_PORT_SMSL_FRONTEND || 27017; // e.g. 27017
var mongoColletion = process.env.MONGO_COLLECTION_SMSL_FRONTEND; // e.g. smsl_frontend/myLogin
var mongoAddressScheme = "mongodb://";
var mongoURI = mongoAddressScheme + mongoAddress + ":" + mongoAddressPort + "/" + mongoColletion;

console.log("Connecting to MongoDB at the uri: ", mongoURI);
mongoose.connect(mongoURI);

var db = mongoose.connection;
db.on('error',console.error.bind(console,'connection error: '));
db.once('connected',function(){
	console.log('Connected to the database');
});

var Schema = mongoose.Schema;
// create a schema
var userSchema = new Schema({
  name: String,
  email: String,
  admin: Boolean,
});

// the schema is useless so far
// we need to create a model using it
var User = mongoose.model('User', userSchema);

// make this available to our users in our Node applications
module.exports = {
	'url': mongoURI,
	'user': User
};
@@ -19,196 +19,8 @@
 .js%0A
-/*%0Amodule.exports = %7B%0A%09// looks example like mongodb://%3Cuser%3E:%3Cpass%3E@mongo.onmodulus.net:27017/Mikha4ot%0A    'url' : process.env.MODULUS_SMSL_FRONTEND_URI%0A%0A%7D;%0A*/%0A// grab the things we need%0A
 var 
@@ -549,522 +549,119 @@
 );%0A%0A
-var db = mongoose.connection;%0Adb.on('error',console.error.bind(console,'connection error: '));%0Adb.once('connected',function()%7B%0A%09console.log('Connected to the database');%0A%7D);%0A%0Avar Schema = mongoose.Schema;%0A// create a schema%0Avar userSchema = new Schema(%7B%0A  name: String,%0A  email: String,%0A  admin: Boolean,%0A%7D);%0A%0A// the schema is useless so far%0A// we need to create a model using it%0Avar User = mongoose.model('User', userSchema);%0A%0A// make this available to our users in our Node applications%0Amodule.exports = %7B%0A%09
+module.exports = %7B%0A%09// looks example like mongodb://%3Cuser%3E:%3Cpass%3E@mongo.onmodulus.net:27017/Mikha4ot%0A    
 'url'
+ 
 : mo
@@ -670,22 +670,9 @@
 oURI
-,%0A%09'user': User
+%0A
 %0A%7D;
+%0A

create URI