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

Connection defined but not required or accessed correctly. #3

Open
leewaygroups opened this issue Oct 4, 2015 · 1 comment
Open

Comments

@leewaygroups
Copy link

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.

@leewaygroups leewaygroups changed the title Connection defined but to required or accessed correctly. Connection defined but not required or accessed correctly. Oct 4, 2015
@anmolkoul
Copy link
Owner

Verifying your observations now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants