Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
using mongolab.com gdg_reporte/gdg_reporte0
- Loading branch information
Showing
4 changed files
with
71 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
var mongoose = require('mongoose'); | ||
var mongo = require('mongo'); | ||
|
||
var dbUrl = "mongodb://gdg_reporte:gdg_reporte0@ds045507.mongolab.com:45507/gdg_reporte" | ||
|
||
var db = mongoose.connect(dbUrl, function(err) { | ||
if (err) { | ||
console.log("error in mongo connection"); | ||
throw err; | ||
} | ||
console.log("connected to mongo"); | ||
}); | ||
|
||
var Schema = mongoose.Schema; | ||
|
||
var Reporte = new Schema({ | ||
time: Number, | ||
type: String, | ||
image: { | ||
path: String, | ||
size: Number | ||
}, | ||
location: [Number] | ||
}); | ||
Reporte.index({ location: '2d' }) | ||
|
||
var ReporteModel = db.model('Reporte', Reporte); | ||
|
||
var saveReport = function(report, cb){ | ||
var reporte = new ReporteModel(report) | ||
reporte.save(cb); | ||
}; | ||
|
||
exports.Reporte = ReporteModel; | ||
exports.db = db; | ||
exports.saveReport = saveReport; | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters