Comments (6)
Hey
Apologies for not responding sooner; I have been up against it on support this week :) Lets see if we can get you up and running.
Seems to be working ok for me; it looks like the collection does not exist; as mongoose.connection.collections['projects'] is returning undefined..
You shouldn't be seeing this error if mongo is running correctly.
Can you run the following; from terminal:
mongo
use vision
show collections
You could also install robomongo; and have a look around; make sure the vision project exists.
Can you also check your db connection; you should have 'mongodb://localhost/vision' in configuration. You could try changing this to 127.0.0.1; you may have an issue with localhost.
Also check which process is using that port:
lsof -i:27017
Let me know how you get on.
from advanced-express-application-development.
I'm running Linux Mint 16 with Node v0.10.25, and installed Mongodb using the built-in software manager. I downloaded RoboMongo and am able to connect and execute functions against Mongo. The database "vision" exists, and I can show collections.
I used RoboMongo to create the "projects" collection just to see if the beforeEach method would drop a collection that previously existed, but I'm still getting the same error. Switching the config to use 127.0.0.1 also results in the same error.
If I run:
moch test
Against Chapter 2 from the Github repo, it works as expected. I'm sure it's something I've done, but I'm not exactly sure what to look for. I'm primarily a Python developer and just getting my feet wet with the Node ecosystem.
A triple-check inspection of my code isn't turning up any differences in structure or syntax up to page 24 of the book. I'm more than happy to create a public repo and drop my code in it for you. Thanks for helping!
from advanced-express-application-development.
That would be great.
from advanced-express-application-development.
Repo is at: https://github.com/alsoicode/vision
from advanced-express-application-development.
Hey
If you look at page 26 you will see you are missing the following from your ./lib/express.js file.
The models are assigned to mongoose from inside ../routes/project in the accompanying service.
Hope this resolves things; let us know.
var express = require('express')
, http = require('http')
, config = require('../configuration')
, db = require('../db')
, heartbeat = require('../routes/heartbeat')
, project = require('../routes/project')
, notFound = require('../middleware/notFound')
, app = express();
app.use(express.bodyParser());
app.set('port', config.get('express:port'));
app.use(express.logger({ immediate: true, format: 'dev' }));
app.get('/heartbeat', heartbeat.index);
app.post('/project', project.post);
app.use(notFound.index);
http.createServer(app).listen(app.get('port'));
module.exports = app;
from advanced-express-application-development.
Thanks Andrew. Looks like I was just missing the post route, and I was premature in running my tests.
from advanced-express-application-development.
Related Issues (9)
- Chapter 2 tests no change (just Github token updated) 22 passed but 2 tests failed. HOT 1
- CH 2, Mongoose returning different object structure
- grunt coverage is not working with latest devDependencies HOT 1
- cafemocha:test aborted HOT 14
- Trouble "Authorising App" in Chapter 5 page 93. HOT 1
- Question not issue HOT 1
- Github Commits - Fatal error: Cannot convert null to object HOT 3
- Discrepancies between the book and the repo HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from advanced-express-application-development.