Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-3745

Trying to insert a custom _id value larger than 800 bytes should raise an exception.

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • ALL

    Description

      Field values larger than 800 bytes are allowed in MongoDB but they can't be indexed. If you insert a document with a large value for an indexed field you will see a log message similar to:

      Thu Sep  1 10:32:34 [conn6]  bigid.foo Btree::insert: key too large to index, skipping bigid.foo.$_id_ 862 { : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx..." }

      See the attached script for a repro. If you then try to query on that field the document won't be returned since it's not in the index. This may be fine for other fields but it causes a lot of problems with large _id values. Tools that walk the _id index (mongodump is a great example) will skip these documents.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bernie@mongodb.com Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: