Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Dennis Klarenbeek17,168 Points
Get the Todo.find is not a function error
I'm following along with the teachers documents but I get an error when I try to get the json object by the postman application.
The following error code I get:
TypeError: Todo.find is not a function
Can somebody help me with this?
Daniel Li15,244 Points
Check in src/models/todo.js
module.exports = model;
var Todo = require('../models/todo');
Ran ShemTov14,148 Points
When the "not a function" error occures, It probably means one of these things:
- You didn't adress it right: Maybe lower or uppercase error that creates a difficulty for the script finding your object.
- Since it's node.js, maybe you didn't "require" right, maybe the path or maybe a typo.
"not a function" actually means (usually) that the script couldn't find your object, thefore it couldn't fit the method (in your case "find") to the object, therefore it says "not a function"