I am quite new in using Mongodb. I have a database exported from a json (the other values at the moment are not important).
The query I am trying to make is this one: I want all the mercancia that all the different client have. So in this case, the client Electronica Chispas, will have 2 mercancia with all the info about it.
[{"cliente": {"nombre": "Cafes el amanencer"},
"mercancia": {"envio": "Normal", "tipo": "Gaseoso", "fecha": "24/12/2003", "peso": 21, "volumen": 43, "origen": "Cadiz", "destino": "Castellon"},
"vagon": {"id": 1330, "volumen": 202, "peso": 433 }},{"cliente": {"nombre": "Electronica Chispas"}, "mercancia": {"envio": "Normal", "tipo": "Liquido", "fecha": "08/02/2005", "peso": 17, "volumen": 24, "origen": "San Sebastian", "destino": "Orense"}, "vagon": {"id": 1290, "volumen": 111, "peso": 464 }},{"cliente": {"nombre": "Electronica Chispas"}, "mercancia": {"envio": "Urgente intradia", "tipo": "Contaminante", "fecha": "15/09/2002", "peso": 11, "volumen": 83, "origen": "Valladolid", "destino": "Ciudad Real"}, "vagon": {"id": 1315, "volumen": 115, "peso": 481 }}]
I am missing some syntaxis or maybe I am just not doing it right. In python (but you can do it in the db itself).
db.prueba1.find({'cliente.cliente': {$mercancias}})
I have syntax error, but there are so many ways to do find() that I am quite lost. I am not looking especifically for the query solved, but the way it could be solved (pseudocode, whatever helps me solve it).
$with mongo provided operations not on field or values.db.prueba1.find({'cliente. nombre': 'Cafes el amanencer'})this will match the second document