Try Studio 3T for Free
  1. Knowledge Base
  2. MongoDB Tutorials
  3. How to Limit MongoDB Collection Size

How to Limit MongoDB Collection Size

By default, Studio 3T loads the first 50 documents of a collection (i.e. dbCursor.find({}).limit(50)) when first opening a collection view.

As MongoDB documents can be up to 16MB in size, this can amount to serious traffic, so we’ve introduced a convenient way of limiting this initial number of documents either for all or specific collections.

Limit number of documents loaded for all collections

  1. Go to Studio 3T > Preferences.
  2. By default, you’ll land on the General tab.
  3. The first field you’ll see is Initial page size when showing result documents. Change the number as needed.
    This will be the initial page size for all collections.
    You can change the initial page size for all collections under Studio 3T > Preferences
  4. Click OK.

Limit number of documents loaded for specific collections

You can also limit the initial number of documents loaded for particular collections, which could come in handy when opening collections with exceptionally large documents, for example.

    1. Right-click on the collection you’d like to open in the Open Connections Tree.
    2. Choose the second option: Open Collection with Custom Page Size.Define the page size of any MongoDB collection you open
    3. Enter the number of documents or initial page size you’d like to load initially.
    4. Click OK.

Once you’ve defined your initial page size, explore your collections in Tree, JSON or Table View. Or for better data analysis, compare your MongoDB collections and spot differences in documents and fields.

Updated on December 5, 2019

Was this article helpful?

Related Articles

Leave a Comment