-1
I have a Mongodb document as an example:
{
"_id": "andresm",
"username": "Andre Salesmo",
"carros": [
{"marca": "ferrari", "tipo": "coupe", "preco": "850000.00", "data_compra": "22/01/2015", "modelo": "512TR"},
{"marca": "nissan", "tipo": "coupe", "preco": "542000.00", "data_compra": "12/05/2018", "modelo": "GTR"},
]
}
I would like to know how I can do a search filtering by id and returning all cars. I am using pymongo as a driver and I was trying in the following way and I did not get result:
cursor = mongo.db.movimentacoes.find(
{"_id": usrId, "carros": {} }
Managed to make it work?
– tvdias