Need advice on data management for CRUD project using MEAN

Hello guys.

It’s my first time doing a CRUD project using the MEAN stack and I’m stuck and need help.

Question : There’s a town with the population in the range of 2000 to 3000. An institution decided to provide ten services — which may vary from time to time — to poor people in which three to four services are for families — like grain and health rationing — while the remaining are for individuals — like scholarships. The total population is divided into ‘N’ clusters. (N = countable fair amount).

Now I need to create an application that allows an end-user to add families and individuals who are availing these services as well as edit, delete, and search operations.

I’m not concerned about the MEAN stack or the code part. My problem is how am I supposed to let the end-user enter this data without repetitions and edit when required. Repetition means, like say, if a family is availing both ration and health services. Both these services need general info like their names, address, yada, yada and the respective service info of the family. What I want is the end-user not to enter the common data multiple times. Even if entered multiple times I don’t want to save the multiple copies of the same data. If the end-user wants to edit the data, how am I supposed to show it? Show the complete services the family is availing as a single form or in multiple forms based on services. How should I save this data? Save the data as a single document (records are called documents in mongo) or create separate collections (tables are called documents in mongo) for each service? When the end-user search for a family, I want to show all the services the family is availing and the end-user derive the data from it. Another thing is how can I incorporate the changes — some services may be added or removed.

I thought of saving the data as a single document and maintain a single collection for all the services. Like this

It’s a rought draft.

What if I create separate collections for each service and try to group them at the end-user side? Would that be good?

But the part — entering multiple family members — is adding complexity and the editing is so much complicated especially rending the form based on the data and incorporating the edits into the document. I’ve got a feeling that this model would be a disaster.

I’m creating this project so that the end-user can keep track of families using these services, get access to the data and modify/update/remove them as necessary.

If there’s any other alternative to do this, I’m glad to hear it.

So I would much like your advice on this. If you’ve any ideas let me know about it. That’d be so helpful. And as well if there’s a part or parts where I can improve or add or remove for better let me know it as well. In simple words give me your unfiltered, thoughtful or whatsoever advice regarding this and I’ll listen to them with an open mind.

Thank you very much.

PS

I don’t know the term to call this process — gathering the data, storing it in a format that’d be efficient to manage, retrieve, editing and such. Maybe I know but I can’t recall at the moment.

it is about a completely different topic (and controversial), but it follows what seems a good projecting of a database, considering that it is about entities with a relationship.
I hope it will give you some inspiration

https://web.archive.org/web/20170914014648/https://qntm.org/gay

1 Like

I didn’t understand. In what way it’s controversial?

If there’s anything I said that shouldn’t have said, let me know. I’ll rectify it next time.

Edit:
Now I understand —after reading the paper— clearly how it can be controversial. Thank you for pointing it out. I didn’t see it before in first place

And yes the paper is really interesting, educating as well. Thank you again for sharing it.

(One thing from my side I am not in anyway a narrow minded person.)