You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks alot for this fantastic project. Both your explanation on the blog and the codes provided
me a good reading and learning experience.
However, I noticed a little issue and identified a way it can be fixed.
Issue:
The mongoose connection (connectionsubject) used in SubjectViews.js was neither defined nor required in
SubjectViews.js. Hence its undefined there.
However, this mongoose connection was defined in server.js and never used there.
Fix:
Move require db.js to SubjectViews.js like this: var db = require('../../config/db');
This stepback (../../) can be avoided but it is ok just to keep the structure of the app and the blogpost in sync.
Also, move:
var mongoose = require('mongoose'); and
var connectionsubject = mongoose.createConnection(db.urlSubjectViews);
to SubjectViews.js
I have fixed this and made a pull request.
The text was updated successfully, but these errors were encountered:
leewaygroups
changed the title
Connection defined but to required or accessed correctly.
Connection defined but not required or accessed correctly.
Oct 4, 2015
Hello Anmol Koul,
Thanks alot for this fantastic project. Both your explanation on the blog and the codes provided
me a good reading and learning experience.
However, I noticed a little issue and identified a way it can be fixed.
Issue:
The mongoose connection (connectionsubject) used in SubjectViews.js was neither defined nor required in
SubjectViews.js. Hence its undefined there.
However, this mongoose connection was defined in server.js and never used there.
Fix:
Move require db.js to SubjectViews.js like this: var db = require('../../config/db');
This stepback (../../) can be avoided but it is ok just to keep the structure of the app and the blogpost in sync.
Also, move:
var mongoose = require('mongoose'); and
var connectionsubject = mongoose.createConnection(db.urlSubjectViews);
to SubjectViews.js
I have fixed this and made a pull request.
The text was updated successfully, but these errors were encountered: