1
Folks good afternoon, I’m in need of some help from someone who has experience with Mongodb to clear me a doubt. I’m studying about Mongodb and I came across the following problem:
I have 2 Collections:
Customers and Users
Each customer has their user list referenced by the respective Objectid. Each user has a Proprietary field to identify the Customer he belongs to.
The point is that I need to create a structure where a client can father other clients, that is to say in my client object I will have a property [Children], where it will contain the Objectid of each Son, and will have tbm the proprietary field to identify if he is the son of someone.
My problem is: How to filter all the users that are mine and the users that are my children’s and my children’s and successively.
I need to create this architecture in Mongodb and I have no idea how to do it, I’m using Node.JS + Mongoose + Mongodb.
Thanks for your help.