I'm planning to implement this schema in Mongodb, I have been doing some readings about schema design, and the notion was whenever you structure your data like a relational database you must be doing something wrong.

enter image description here

My questions:

  • what should I do when collection size gets larger than 16MB limit? app_log in server_log collections gets might in some cases grow larger than 16MB depending how busy the server is.

    I'm aware of the cap feature that I could use, but the requirement is store all logs for 90 days.

  • Do you see any potential issues with my design?

  • Is it a good practice to have the application check for collection size and create new collection by day / hour ..etc to accommodate log size growth?



1 Answer 1


16 MB is the maximum size of single document, e.g. one user.

The size of the collection is limit by maximum database only.


So logging to the database should be no problem. In my opinion using sensible indizes including _id is superior to a heap of collections.

It is not clear to me what you actually want to store in your database so I cannot really comment on the structure. Generally speaking there are three ways to handle relations: Using arrays

  • storing subdocuments or
  • ids of documents (You would have to retrieve those via a separate database request)
  • invert the relation by giving all referenced documents a field containing the parent document id

If you give more details, chances are somebody can give you a more detailed answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.