Tag

failIndexKeyTooLong

1 views collected around this technical thread.

360 Zhihui Cloud Developer
360 Zhihui Cloud Developer
May 13, 2021 · Databases

Why MongoDB’s Unique Index Fails When Index Keys Exceed 1024 Bytes

The article reproduces a MongoDB issue where queries using a hashed shard key return no results and a compound unique index silently accepts duplicate documents, explains that the failIndexKeyTooLong parameter allows oversized index entries to be stored without indexing, and shows how to reproduce and fix the problem.

Hash ShardingIndexUnique Constraint
0 likes · 34 min read
Why MongoDB’s Unique Index Fails When Index Keys Exceed 1024 Bytes
360 Tech Engineering
360 Tech Engineering
May 7, 2021 · Databases

MongoDB Sharding Key Query Failure and Unique Index Violation Explained

This article reproduces a MongoDB issue where queries using a hashed sharding key return no results and a unique compound index appears to fail, then explains the root cause—index entries exceeding the 1024‑byte limit and the failIndexKeyTooLong parameter—providing step‑by‑step commands, configuration changes, and practical recommendations.

IndexingShardingdatabase
0 likes · 35 min read
MongoDB Sharding Key Query Failure and Unique Index Violation Explained