Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

534
Views
In MongoDB, what is the purpose of embedded documents if the same thing can be achieved without using them?

For example

Instead of a field named, COLUMN_1, that holds an embedded document with fields A, B, and C.

Why not 3 separate fields with names COLUMN_1_A, COLUMN_1_B, COLUMN_1_C.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

In mongoDB you prefer to work with documents the way they exist naturaly , afcourse you can create routines that can translate every time and assemble/disasemble the document:

  COLUMN_1:{A:X,B:Y,C:Z}

to:

 COLUMN_1_A:X,COLUMN_1_B:Y,COLUMN_1_C:Z

But this is additonal work that you dont want to do every time , you are a lazy effective developer that prefer just store your json document the way it will be used unless there is a specific use case that make sence to do it this way ... :)

Also please, note embedding is possible up to 100 levels , but max document size is still limited to 16MB , so in your document model it is not expected that you embed all your database in single document...

When you need performance , you add indices and optimize queries , that way your most searched data stay in memory , there is no big difference if your fields are embeded or in the root if they are not indexed ...

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!