TypeError: Cannot call method 'find' of undefined #306

mihaipaun opened this Issue Feb 3, 2013 · 8 comments

6 participants


I'm having a issue when I try to use mongo for persistence. This is the output that I get in the console when I try to list all the items of a model (e.g. http://localhost:4000/todos)

        throw err;
TypeError: Cannot call method 'find' of undefined
     ERROR Worker 10591 died.

I've set up the config object in config/development.js like so:

var config = {
  detailedErrors: true
, debug: true
, hostname: 'localhost'
, port: 4000
, model: {
    defaultAdapter: 'mongo'
, db: {
  mongo: {
    dbname: 'test'
, sessions: {
    store: 'memory'
  , key: 'sid'
  , expiry: 14 * 24 * 60 * 60

module.exports = config;

Also, I have mongodb-wrapper installed locally.

Does anyone know what could be the issue here?


Verify the mongo instance is fine by utilizing the shell - terminal - type mongo. http://docs.mongodb.org/manual/tutorial/getting-started-with-the-mongo-shell/#start-the-mongo-shell

You may find this question annoying but it is a first step.

mde commented Feb 4, 2013

Looks like mongodb-wrapper has changed enough that we need to specify a version, or update Model to use the newest. A guy in IRC said it needs to be 0.4.x.

This raises the question of how we can specify versions for libraries that are assumed to be locally installed inside the app. Here's the issue I've opened for this:



It worked with "mongodb-wrapper": "0.4.x". Thanks!


Hi, I'm also having this problem. Where do you specify that tag, how do you install that version of the mongodb wrapper (OSX)?


Kumoriuk you'll need to edit your package.json and add the mongodb line to tour existing dependencies.

   "dependencies": {
      "mongodb-wrapper": "0.4.x"

Then you should do npm install


That did the trick, thank you!


You're welcome, glad I could help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment