I have two schemas.
FAQ Schema
const EventFAQSchema = mongoose.Schema({
question: { type: String, req: true },
answer: { type: String, req: true }
});
EventSchema
const EventSchema = mongoose.Schema({
"title": { type: String },
"description": { type: String },
"eventFAQs": [{
type: FAQSchema,
default: FAQSchema
}]
})
I am trying to embed an array of objects of type FAQ. But I get the following error
Undefined type 'undefined' at array 'eventFAQs'
I know I am missing a fundamental concept of array of objects. But I have spent a good deal of time trying to find out the reason and couldn't resolve it myself.
via Giridhar Karnik
No comments:
Post a Comment