Maximum number of Collections

Hey @dushan_Silva,

I don’t think it’s a good idea. Why not use just one collection and a field tenant with an index on it to support your queries?

One collection = at least one index (_id) and 2 files. One for the index and one for the collection (with the WiredTiger engine). More than 10K collection is usually not a good news for your file system.

Having a lot of collections is an anti-pattern:

https://www.mongodb.com/article/schema-design-anti-pattern-massive-number-collections

Just like an array in a document should be bounded, the number of collections should also be limited. 10 collections with 10 documents each isn’t the same as 100 documents in 1 collection. The later is more optimal.

Cheers,
Maxime.

1 Like