I have this problem. I have this dataBase in mongoDB:
{
"_id" : ObjectId("585fe33d3c63b4a81e00002b"),
"class" : [
{
"name" : "class 1",
"people" : [
{
"id" : "58596",
"name" : "mark",
},
{
"id" : "45643",
"name" : "Susan",
},
{
"id" : "85952",
"name" : "Loris",
}
},
{
"name" : "class 2",
"people" : [
{
"id" : "58456",
"name" : "Sissi",
},
{
"id" : "45643",
"name" : "Susan",
}
]
}
]
}
I use php and I would like to know the names of the class with a specific name inside and save them in an array.
For example if I choose Susan i would like to have an array with ["class 1" , ["class 2"]
.
I have used findOne but this time i need to use find.