M
M
mamont802017-09-09 11:37:11
MongoDB
mamont80, 2017-09-09 11:37:11

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

1 answer(s)
L
longclaps, 2017-09-09
@mamont80

Down with doubt .
ps " into the flesh " literally means "into the meat", did you really want to express yourself so vigorously? )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question