Details
-
Bug
-
Resolution: Duplicate
-
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.