UNPKG

hulawho

Version:
32 lines (27 loc) 736 B
var mongoose = require('mongoose') var config = require('./config') var Prediction = require('../lib/index').Prediction mongoose.connect(config.mongo_url) mongoose.connection.on('connected', function(){ console.log("Connection to mongodb established") }) mongoose.connection.on('error', function(err){ console.log(err) }) mongoose.connection.on('disconnected', function(){ console.log("Connection to mongodb disconnected") }) var predictionProfile = { user: '5b2a6c2ff37b63c961398bef', game: '5b2a6c8fd89018ca7c8dfa70', home_score: 3, away_score: 0 } var prediction = new Prediction(predictionProfile) prediction.addPrediction(function(err, res) { if(err) { console.log(err) return } console.log(res) })