[SERVER-3745] Trying to insert a custom _id value larger than 800 bytes should raise an exception. Created: 01/Sep/11  Updated: 01/Sep/11  Resolved: 01/Sep/11

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Bernie Hackett Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File big_id.js    
Issue Links:
Related
Operating System: ALL
Participants:

 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.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 01/Sep/11 ]

See SERVER-3372

Generated at Thu Feb 08 03:03:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.