Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-2918

Re-word index key size description

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • v1.3.2
    • Affects Version/s: None
    • Component/s: manual

      http://docs.mongodb.org/master/reference/limits/#Index Key

      I recently learned that the v1 index key size is only stored as bson when the string length is > 255. Let's figure out a way to make this description helpful without digging too far into the weeds of what the size is...

      The total size of an index key entry must be less than 1024 bytes. The total size includes the following overhead:
      
      5 bytes for the BSON document structure,
      1 byte for type specification for each field in the index key,
      any additional representation overhead for each field in the index key.
      For example, a string has a representation overhead of 5 bytes: 1 byte for the null terminator plus the 4 bytes to specify the length of the string including the terminator. Then, for an index on a string field, the indexed field value must be less than 1013 bytes. For a compound index on two string fields, because each field adds 6 bytes of overhead (1 for type specification and 5 for representation) as well as the 5 bytes for the BSON document structure, the key size must be less than 1007.
      

            Assignee:
            kay.kim@mongodb.com Kay Kim (Inactive)
            Reporter:
            dan@mongodb.com Daniel Pasette (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              10 years, 6 weeks, 2 days ago