I have a collection where I store information in an array of objects named Degrees
.
Each object in this array has keys like {Uni:'',Level:'',Degree:''}
. I am trying to create a query that will help me find documents with a degree where the level = 'BS'
, regardless of the other fields in the object.
My current attempt looks like this:
{
$elemMatch: {
$eq: {
Uni: {
$exists: true,
},
Level: "BS",
Degree: {
$exists: true
}
}
}
}
However, this approach hasn't been successful. Do you have any suggestions for improvement?