var mongoose = require('mongoose');

mongoose.connect('mongodb://localhost:27017/mydb');

//schema//
var locationSchema = mongoose.Schema({
        city : String
    })


var db = mongoose.connection;
db.on('error',console.error.bind(console,'connection error'));
db.once('open',function(callback){
    console.log('Mongodb is connected');
}); 

module.exports.create = function(city){
    //Model//
    var Locations = mongoose.model('location',locationSchema)

    var cityLocation = new Locations({city:'milano'})
    console.log(cityLocation.city)    
}
@@ -162,16 +162,83 @@
 %0A    %7D)%0A
+//Model//%0Avar Locations = mongoose.model('location',locationSchema)
 %0A%0Avar db
@@ -450,85 +450,8 @@
 y)%7B%0A
-    //Model//%0A    var Locations = mongoose.model('location',locationSchema)%0A%0A
     

add db