I have two schemas, one of which is nested within the other. For the sake of the example:
const firstSchema = {
name: String
}
const secondSchema = {
example: [firstSchema],
count: Number
}
const First = mongoose.model('First', firstSchema)
const Second = mongoose.model('Second', secondSchema)
Is there a way to do the following?
I want to find one specific secondSchema (let’s say using the find method) and then:
Within that secondSchema, I want to find a specific firstSchema, without looping
through the array, but instead again using something like find.