Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed mongoose depreciated Promise library #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/models/school.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
var q = require('q');
var mongoose = require('mongoose');

// Setup DB Promise
mongoose.Promise = q.Promise;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem like the right place to do this. I would imagine putting it in server.js like you did and also in app/scripts/schools.js would do it. Does it need to be in this file?


module.exports = mongoose.model('School', {
name: String,
entityName: String,
Expand Down
2 changes: 2 additions & 0 deletions app/scripts/schools.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ var School = require(__dirname + '/../models/school');

var fs = require('fs');



School.findOne({})
.then(function(school){
if(!school){
Expand Down
7 changes: 5 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down