Answer the question
In order to leave comments, you need to log in
Why can't I get a list of categories?
The collection looks like this:
Schematic like this:
const categorySchema = new mongoose.Schema({
title : { type : String },
subCategories: [
{
name: { type: String }
}
]
})
await Category.find()
Answer the question
In order to leave comments, you need to log in
Most likely the name of the collection is different from the name of the collection that Mongoose is looking for.
The call to mongoose.model sets the name of the collection the model is bound to, defaulting to the model name in lowercase plural.
Source: https://stackoverflow.com/questions/14183611/mongo...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question