Giter Site home page Giter Site logo

Comments (6)

AndrewKeig avatar AndrewKeig commented on July 20, 2024

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.

alsoicode avatar alsoicode commented on July 20, 2024

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.

AndrewKeig avatar AndrewKeig commented on July 20, 2024

That would be great.

from advanced-express-application-development.

alsoicode avatar alsoicode commented on July 20, 2024

Repo is at: https://github.com/alsoicode/vision

from advanced-express-application-development.

AndrewKeig avatar AndrewKeig commented on July 20, 2024

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.

alsoicode avatar alsoicode commented on July 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.