diff --git a/app/models/school.js b/app/models/school.js index 5c804b8..e78b252 100644 --- a/app/models/school.js +++ b/app/models/school.js @@ -1,5 +1,9 @@ +var q = require('q'); var mongoose = require('mongoose'); +// Setup DB Promise +mongoose.Promise = q.Promise; + module.exports = mongoose.model('School', { name: String, entityName: String, diff --git a/app/scripts/schools.js b/app/scripts/schools.js index c560d96..748d052 100644 --- a/app/scripts/schools.js +++ b/app/scripts/schools.js @@ -6,6 +6,8 @@ var School = require(__dirname + '/../models/school'); var fs = require('fs'); + + School.findOne({}) .then(function(school){ if(!school){ diff --git a/server.js b/server.js index 9e767de..ddb7194 100644 --- a/server.js +++ b/server.js @@ -13,10 +13,13 @@ var methodOverride = require('method-override'); var mongoose = require('mongoose'); var morgan = require('morgan'); + + // DB Promise Library + mongoose.Promise = require('q').Promise; // Configuration - - //DB + + // DB mongoose.connect(config.db.url) .then(function(){ console.log('Mongoose Connected');