Answer the question
In order to leave comments, you need to log in
Should I duplicate the "header" from a large entry in another collection in mongodb?
Question about best practices when working with mongodb, not a specific example.
Let's say there is a large record (in the flesh up to 16Mb), for example, a letter. And there are its short properties: subject, date, etc.
There are two cases: viewing one letter (document) as a whole, and for example viewing a list of letters (subjects, dates).
It's convenient to keep all the properties in one entry for document viewing, but would it be efficient to select a list of only email subject lines by date? Is it worth making a separate collection of full documents and additionally a collection of "caps" from short properties.
I am tormented by doubts, if you use 1 collection, then when you request only a short document property, the entire or almost entire document will be read from disk. If you use 2 collections, then when editing, you will have to update 2 collections and there may be discrepancies with the business logic, with all the ensuing theoretical consequences.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question