I would like to create a data base using mongodb and I am wondering how to query nested entities. For instance, let's assume we create a db as follows:
from pymongo import MongoClient
db = client['test_database']
collection = db['test_collection']
dat=[
{ "id":110, "data":{"Country":"ES","Count":64}},
{ "id":112, "data":{"Country":"ES","Count":5}},
{ "id":114, "data":{"Country":"UK","Count":3}}
]
collection.insert(dat)
how can we query the records with "Country" values "ES"? Or alternatively how can we query the records with "Count" less than 6?