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

Databases

Where collection name is defined?

In this lecture didn't specify collection name "animals" anywhere. I'm confused how MongoDB took that name for the collection.

1 Answer

From the video transcripts starting at 7:04

Let's create a model called Animal. We do this by using the mongoose method model. Passing in the name of the model, Animal, and the schema that defines animals. Mongoose will pluralize the string we supply as the first parameter here. This will map to a collection in the mongodb database whenever we save the document. In this case the model will create or map to a collection named animals.

Ok, Understood now, Thank you.