4

I would like to know if mongodb has a limitation on the depth of embedded documents in a mongo document. I am not concerned about the 16MB limit on mongo documents only about the number of subsequently embedded documents allowed. In other words, in the example below how many times is the child embedded document allowed to be repeated until mongo does not allow of insertion of this document into a mongodb collection.

{
child: {
 child: {
  child : {
        (child repeated n times)
}}}}
Community
  • 1
  • 1
aruuuuu
  • 1,605
  • 2
  • 22
  • 32

1 Answers1

6

MongoDB supports no more than 100 levels of nesting for BSON documents.

See mongodb limits

Ori Dar
  • 18,687
  • 5
  • 58
  • 72
  • Maybe it doesn't for local dbs? I have a MongoDB on a linux machine and it will only allow 3 levels deep – devin Feb 06 '23 at 02:27