good morning.
I have the following collection in mongoDb:
{
"signupDate": "2018-11-22T19:14:02.047Z",
"_id": "5bf700269e5b59276885eda5",
"userName": "pruebas",
"email": "[email protected]",
"password": "abc1234",
"interests": "{\"followEmails\": false, \"dogs\": [{\"raza\": \"poodle\",
\"age\": 2},{\"raza\": \"poodle\", \"age\": 7}]}",
"phone": "00000",
"imgProfile": "img/profile/user.png",
"Emailverify": false,
"passwordHas":
"$2a$10$y1Wty9OUQUmOB5B90kEDY.DWR6umNgGURznJxkhdpI.pbNGelS/Qe",
"__v": 0
},
I need to create a query that returns to me the users who have in their field interest- > dogs = a certain breed of dog. I have already tried several queries since robomongo but I still do not give.
This query returns all the users that contain in the object interests the key dogs.
db.getCollection('users').find({},{interests: [ "dogs"]})