Which is the mongo-way to manage select input fields?

20 views
Skip to first unread message

Francesco Pellegrini

unread,
Apr 22, 2016, 7:17:14 AM4/22/16
to mongodb-dev
Each and any app I develop has plenty of input forms which in turn have plenty of input fields made out of combos, listboxes, radio/checkboxes ect.
Each of them has the purpose to display a text while storing its value/id, then send back the Value/id to have it persisted in a db.

I do agree that embedding child documents is a very good way to gain in performances when storing/retrieving trees, like order and items, or person and addresses and so on, but in the above case I really do not know how mongo can be efficently and reliably used.
In real world apps CRUD is 80% of work, and after creating a document I need to edit it and modify its properties many times during its lifetime, so I cannot store just the value of a select field, because next time I have to edit the document I cannot populate reliably a combo and present the correct selected value based on its description. I have to store IDs.

And here is the question: having tenth of documet types (forms) with tenth of selects, every and each time I end up with the need of hundreds of foreign keys.

An RDBMS guarantees me that I cannot delete a record if it is referenced somewhere.

Is this the correct/usual way to do this also with mongodb or there are better ways?



Bryan Reinero

unread,
Apr 22, 2016, 5:26:38 PM4/22/16
to mongodb-dev
HI Francesco,

This forum is for discussions of MongoDB project development, not for discussions about usage.Would you mind re-posting your question in the mongodb-user forum?

thanks,
Bryan
Reply all
Reply to author
Forward
0 new messages