Click here to Skip to main content
15,867,939 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have a collection of Groups and a collection of People (each Group or People have a unique ID). Group can hold X amount of People. I'm using the microservice methodology so my collections can't be linked together.
I'm need to populate the array of People ID in every Group so inside every groups will be the document of People and not just an ID.

Usually I would use populate. But because they can't be linked I can't, can someone help me solve this problem?

example:

groups:

name: <some string="">
id: <some unique="" id="">
people: <array of="" id="" some="" people="">

people:

name: <some string="">
id: <some unique="" id="">


what I'm trying to do:

groups:

name: <some string="">
id: <some unique="" id="">

people: [

people:
name: <some string="">
id: <some unique="" id="">,

people:
name: <some string="">
id: <some unique="" id="">,

...
]

What I have tried:

I thought about getting all the collection (Group or People) and then an array of ID from the collection I didn't get and then doing something to merge them togather
Posted
Comments
Richard Deeming 5-Aug-22 8:46am    
If you can't link closely related collections of objects together because you're "using the microservice methodology", then I would suggest you're doing it wrong.

Microservices doesn't mean having a separate service for every entity. If two entities are closely linked, then it's perfectly reasonable to have them both in the same microservice.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900