From ee82a98b2d4d744a962a765fb5e05c80c4f334eb Mon Sep 17 00:00:00 2001 From: lance13c Date: Fri, 28 Apr 2017 00:10:50 -0400 Subject: [PATCH] changed mongoose depreciated Promise library --- app/models/school.js | 4 ++++ app/scripts/schools.js | 2 ++ server.js | 7 +++++-- 3 files changed, 11 insertions(+), 2 deletions(-) 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');