I've been exploring the JSON-BSON structures of MongoDB, but I'm struggling to understand how to insert documents into other documents and query them.
Here's what I'm curious about - let's say someone wants to store an array of documents within another array, like in a school:
const university = mongoose.Schema(
{
name : {type : String, require : true, unique : true},
school : [{
schoolName : String
}]
});
Could someone explain how to insert documents within an array of documents based on the name? I'm new to MongoDB and would appreciate any guidance.