apache / apache/couchdb

key vs endkey

Open
#3,977 7 comments 0 reactions 0 assignees View on GitHub
beginner-friendly bug enhancement
Dominant language
Erlang
Stars
7k
Forks
1.1k
Avg merge
1d 16h
Merged PRs (30d)
9

Description

I believe that if `key` is provided, then `endkey` should be ignored? The docs seem to be unclear on this. However, the behavior I get is the opposite.

```js
await couch.put('a', {})
await couch.put('b', {})
await couch.put('c', {})

const { rows } = await couch.allDocs({
key: 'a',
endkey: 'b'
})
console.log(rows)
```

```
test/index.js 2> [
test/index.js 2> {
test/index.js 2> id: 'a',
test/index.js 2> key: 'a',
test/index.js 2> value: { rev: '1-967a00dff5e02add41819138abb3284d' }
test/index.js 2> },
test/index.js 2> {
test/index.js 2> id: 'b',
test/index.js 2> key: 'b',
test/index.js 2> value: { rev: '1-967a00dff5e02add41819138abb3284d' }
test/index.js 2> }
test/index.js 2> ]
```

Looks like a bug?

couchdb:3.1.1

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the allDocs({ key, endkey }) example from test/index.js against CouchDB 3.1.1, then read the allDocs API documentation and the related implementation. Confirm whether key and endkey should be combined or whether key takes precedence, and update the behavior or documentation so the result and tests match the documented semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang, javascript
Domain
api, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.