Answer Posted / Satyendra Kumar
To define an array in a Mongoose schema, use the Array data type followed by the element's schema: const mySchema = new Schema({ /* other fields here */ items: [myItemSchema] }); This creates an array field named 'items', where each item conforms to the specified schema (myItemSchema).
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers