Reduce the size of documents

Hi Team,

We are using Atlas which is saw that in Performance advisor to us like below.

“Reduce the size of documents”

Large documents can result in excess cache pressure, especially if a small portion of them are being updated or queried.

Can you please briefly explain How to reduce documents size in production server without any impact application. what steps are we following ? any MongoDB commands let me know

This is urgent… i need to explain to my app team.

I do not think that it is possible without any impact application.

Some strategies to reduce document size are:

  1. shorter field names, but it impacts the application because the field names are changed
  2. split big documents into 2 or more parts so that fields seldom used are in secondary collections, but it impacts the application because you have to $lookup when you want to access the seldom used fields

The easiest way to reduce cache pressure that does not affect the application is to add more RAM.

How to split big documents into 2 or more parts explain with examples with large data

any easiest way instead of add more RAM ?

This is my big document from collection mainCollection:

{
  "user" : "steevej" ,
  "first_name" : "Steeve" ,
  "last_name" : "Juneau" ,
  "phone_number" : "...." ,
  "email" : "..." ,
  "preferences" : { ... } ,
}

refactored to

// mainCollection keeps most used fields
{
  "user" : "steevej" ,
  "preferences" : { ... } ,
}

// secondary collection named ***userProfile*** for seldom used fields.

{
  "user" : "steevej" ,
  "first_name" : "Steeve" ,
  "last_name" : "Juneau" ,
  "phone_number" : "...." ,
  "email" : "..." ,
}