You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
QueryIndexAsync with equal string bounds also returns every key that starts with that value #208
QueryIndexAsync("idx_name", "g1", "g1") on an index over a string property returns the documents whose name is exactly g1 and also every document whose name starts with g1 (g1001, g1003, …). In the probe that found it, 556 hits instead of one.
String keys are encoded as [0x02][utf-8 bytes] with no terminator, and composite secondary keys are [user key][document id]. The upper bound built by CreateCompositeKeyBoundary(userMaxKey, useMinObjectId: false) (CollectionSecondaryIndex.cs:386-404, helper at :572) appends a maximal id suffix to g1, which sorts after g1001…, so longer values that share the prefix fall inside the range.
Expected
Equal bounds return only the documents whose value equals the bound. A range ["g1", "g2"] should include g1001 (it sorts between them), but ["g1", "g1"] should not.
Possible fix
Bound the user key by its length as well, e.g. use [user key][id prefix byte] .. [user key][id prefix byte + 1] for the upper bound of an inclusive equal key, the same approach #182 uses for the unique check, or add a terminator to string keys in a future key format.
Activity
mrdevrobot commentedon Oct 13, 2026
Duplicate of #206, fixed by #214.