readyprompt opened a new pull request, #6121:
URL: https://github.com/apache/couchdb/pull/6121

   ## Overview
   
   `POST /{db}/_find` with a range predicate on `_id` silently returns a
   subset of the matching documents.
   
   The in-memory selector match compares `_id` values with ICU collation
   instead, so it filters out ids the index returned. 
   
   ## Testing recommendations
   Enter the following documents into a pristine un-patched database:
   {"ok":true,"id":"B0","rev":"1-6195f101ce8acfa70869ca4b783b99e1"}
   {"ok":true,"id":"Z1","rev":"1-6d208a03addfe477833d31b02724aa9f"}
   {"ok":true,"id":"a1","rev":"1-2d678f2459fde9186a805498643f0c55"}
   {"ok":true,"id":"b9","rev":"1-9119134824d79b9a2a39cd2fd6d86fbe"}
   {"ok":true,"id":"m5","rev":"1-d0ccbd66d0fa7465b389d833f4ab37ba"}
   {"ok":true,"id":"zed","rev":"1-8e417bfe26e079178a669c618f4acc08"}
   
   _all_docs?startkey="Z" will return all of them, but _find _id >=  "Z" will 
return
   
   {"docs":[
   {"_id":"Z1"},
   {"_id":"zed"}
   ],
   
   _find a._id >= "Z" will return the same results as above.
   
   Now, apply the patch and run the same _all_docs and _finds from above:
   _all_docs?startkey="Z":
   {"total_rows":6,"offset":1,"rows":[
   {"id":"Z1","key":"Z1","value":{"rev":"1-6d208a03addfe477833d31b02724aa9f"}},
   {"id":"a1","key":"a1","value":{"rev":"1-2d678f2459fde9186a805498643f0c55"}},
   {"id":"b9","key":"b9","value":{"rev":"1-9119134824d79b9a2a39cd2fd6d86fbe"}},
   {"id":"m5","key":"m5","value":{"rev":"1-d0ccbd66d0fa7465b389d833f4ab37ba"}},
   {"id":"zed","key":"zed","value":{"rev":"1-8e417bfe26e079178a669c618f4acc08"}}
   ]}
   
   _find _id >= "Z":
   {"docs":[
   {"_id":"Z1"},
   {"_id":"a1"},
   {"_id":"b9"},
   {"_id":"m5"},
   {"_id":"zed"}
   ],
   
   _find a.id >= "Z":
   {"docs":[
   {"a":{"_id":"Z1"}},
   {"a":{"_id":"zed"}}
   ],
   
   
   ## Related Issues or Pull Requests
   
   #5869 and #6040 are related.
   
   ## Checklist
   
   - [x] This is my own work, I did not use AI, LLM's or similar technology
   - [x] Code is written and works correctly
   - [x] Changes are covered by tests
   - [ ] Any new configurable parameters are documented in 
`rel/overlay/etc/default.ini`
   - [ ] Documentation changes were made in the `src/docs` folder
   - [ ] Documentation changes were backported (separated PR) to affected 
branches
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to