1

I know that document size can be upto 16 Mega in size as per this documentation.

But in one of my requirement, i need to store long string values inside array like below.

content: [content1, content2, content3]

content1, 2 and 3 are HTML strings. Each one may have 6000 chars max in size including html tags.

Is this right way to do like this? Any disadvantage by this way?

1 Answer 1

1

In indexing, there seems to be a bit of a disadvantage:

Index Key

The total size of an indexed value must be less than 1024 bytes. MongoDB will not add that value to an index if it is longer than 1024 bytes.

(From MongoDB Limits and Thresholds)

Other notes

However, even though we are dealing with NoSQL here, I'd still keep database normalization in the back of my mind: if the content is always 3 HTML strings, having different semantics (like "short lead", "lead", "article", or something like this), I would have them in separate fields.

Sign up to request clarification or add additional context in comments.

1 Comment

@user10 Ok, then your data structure is totally OK.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.