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! While you're at it, check out some resources Treehouse students have shared here.
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
Ikuyasu Usui
36 PointsIn User = mongoose('User', UserSchema), which User is actually important?
Is it okay to have const User = mongoose('Userrr', UserSchema); module.exports = User; ?
and use 'Userrr' as a class in the exported file like const user = new Userrr(); ?
Do we code like that just to make things clear?
Nick Trabue
Courses Plus Student 12,666 PointsNick Trabue
Courses Plus Student 12,666 PointsAccording to the docs http://mongoosejs.com/docs/models.html
The first argument is the singular name of the collection your model is for. Mongoose automatically looks for the plural version of your model name.
So you'd be telling mongoose to look for your userrrs collection in the database which is probably not what you want.
the variable name is what you're going to call to create a new one. So if you had something like