Need to know how we handle the bigger data

Hi,
Following is my Schema which i’m using for storing the POST

module.exports = {
  id: {type: 'UUID', required: true},
  userId: {type: 'UUID of User', required: true},
  likesCount: {type: 'Integer', required: true, default: 0},
  commentsCount: {type: 'Integer', required: true, default: 0},
  description: {type: 'String'},
  media: [{
    id: {type: 'UUID', required: true},
    URL: {type: 'URL', required: true},
    mimeType: {type: 'String', required: true},
    createdAt: {type: 'Timestamp'}
  }],
  active: {type: 'Boolean', required: true, default: true},
  _deleted: {type: 'Boolean', required: true, default: false},
  tagUsers: [{
    userId: {type: 'UUID of User', required: true},
    userInGameName: {type: 'String', required: true}
  }],
  reports: {
    count: {type: 'Integer', required: true, default: 0},
    reportedBy: [{
      userId: {type: 'UUID of Users'},
      comments: {type: 'String', required: true}
    }],
  },
  createdAt: {type: 'Timestamp'},
  updatedAt: {type: 'Timestamp'}
};

With this i’m facing the issue 16 Mb increase the size of collection,
Can anybody suggest me over here how do i handle this kind of BIG Data,
And i need to make structure like which can handle Milllions of Data.

Thankd

Hi @Tajinder_Singh1,

Working with large documents can complicate your database usage and likely isn’t a great idea. For example, it greatly increases the memory requirements of your server. Having large documents travel between the server and client also slows the application down. And there’s the obvious problem of the client application having to create objects the size of your document!

I recommend working with smaller documents. It makes for better, more scalable applications. We have a lot of content on how best to design schemas. Here are a few of my favorite resources:

I’m also doing a session on advanced schema design for MongoDB.live:

Thanks,

Justin

2 Likes