Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Jordan Watson
Jordan Watson
14,738 Points

Users exceeding MongoDB Document size?

Quick side note! I am loving this course, I'm learning a lot about express and mongo + mongoose! Although one thing i'm not 100% sure about. I thought a rule of thumb was mongoDB's document size can/should not exceed 76kb or there about's? If for talking sakes say 1000's of users are logged in would this not ramp up the document size so far with me logged in to the session collections total document size is 190 Bytes

2 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Jordan;

As a bit of context with the document size in MongoDB, the 16MB limit is per document, not per collection, right? This limit is one of the BSON limitations.

16MB may seem small but in comparison all of the works done by William Shakespeare come in at something like 5MB. If you are storing information in a document and it will exceed the 16MB limit, you can use the GridFS specification for storage.

The way in which one designs your document schema is very important in MongoDB for a lot of reasons. Document size is one of them, but the limitation generally isn't the bottleneck in performance.

Post back with further questions!

Ken

Jordan Watson
Jordan Watson
14,738 Points

Perfect Thank you this answers my question spot on! Yeah your right 16mb is a lot of data especially just for strings and numbers...

Scott Wyngarden
PLUS
Scott Wyngarden
Courses Plus Student 16,700 Points

From their own documentation, it looks like the current maximum size is 16MB. Looking around, I'm not seeing much discussion about any ideal sizes for documents, and 76kb sounds unnecessarily small as the size to store in the database.

Jordan Watson
Jordan Watson
14,738 Points

Yeah sorry, reading my question back your right that was an error on my part I did not mean to write 75kb... although 16mb is not a large amount of storage for user data either.