i'm learning MongoDB and i have the next questions.
There are my MongoDB documents
This is coordenada document
> db.coordenada.find().pretty()
{
"_id" : ObjectId("5579b81342a31549b67ad00c"),
"longitud" : "21.878382",
"latitud" : "-102.277364"
}
{
"_id" : ObjectId("5579b85542a31549b67ad00d"),
"longitud" : "21.878626",
"latitud" : "-102.280379"
}
{
"_id" : ObjectId("5579b89442a31549b67ad00e"),
"longitud" : "21.878845",
"latitud" : "-102.283512"
}
{
"_id" : ObjectId("5579b8bf42a31549b67ad00f"),
"longitud" : "21.879253",
"latitud" : "-102.286698"
}
{
"_id" : ObjectId("5579b8dd42a31549b67ad010"),
"longitud" : "21.879203",
"latitud" : "-102.291558"
}
{
"_id" : ObjectId("5579b8fd42a31549b67ad011"),
"longitud" : "21.878427",
"latitud" : "-102.296375"
}
{
"_id" : ObjectId("5579b91d42a31549b67ad012"),
"longitud" : "21.877571",
"latitud" : "-102.299659"
}
And this is rutas document
> db.rutas.find().pretty()
{
"_id" : "1",
"nombre" : "Ruta Penal",
"numero" : "20",
"coordenadas" : [
DBRef("coordenada", "5579b91d42a31549b67ad012")
]
}
{
"_id" : "2",
"nombre" : "Ruta Penal",
"numero" : "20",
"coordenadas" : [
DBRef("coordenada", "5579b91d42a31549b67ad012")
]
}
{
"_id" : "3",
"nombre" : "Ruta Penal",
"numero" : "20",
"coordenadas" : [
DBRef("coordenada", "5579b85542a31549b67ad00d")
]
}
{
"_id" : 6,
"nombre" : "Ruta Penal",
"numero" : "20",
"coordenadas" : [
DBRef("coordenada", "5579b85542a31549b67ad00d")
]
}
>
What i'm tryin to do, it's obtain the "longitud" and "latitud" from "coordenada" but only for the "numero" 20 of "rutas" document for instance
How can i do this?
PS sorry for the spanish terms.