6
I know Mongodb doesn’t have Ner Join,
but I really need to filter the data from a Collection by reference to its _id in another Collection.
I need to display only the projects of a particular user.
No question of restructuring the base.
Collections:
usuarios: { _id: ObjectId("..."), nome: "usuario", ... }
projects:
{ _id: ObjectId("..."), nome: "projeto1", ...}
users:
{ _id: ObjectId("..."), idProjeto, idUsuario }
In short, I want to pass the _id user and he bring me all his projects without changing the structure above. It is possible?
You want to do it inside the Mongo Shell?
– Leonel Sanches da Silva
Whatever. I wonder if there’s a way out.
– Igor Barreto
It exists, but it involves a programming language. Mongodb, as the answer given, does not have native support for
joins. You who have to make your application read the dependent data.– Leonel Sanches da Silva
You have the code of some solution with php for me to understand?
– Igor Barreto
http://www.sitepoint.com/modeling-data-relationships-in-mongodb/
– Leonel Sanches da Silva