Couch ignores use_index, and Pouch errors on use_index, and they both are choosing different indexes by default
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 30/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- databases
Direzione di ricerca
Inizia confrontando il comportamento HTTP di _find e _explain in CouchDB 3.3.3 e PouchDB 8.0.1, concentrandoti sulla selezione predefinita dell'indice e sull'uso dell'opzione use_index. Riproduci i selettori e gli indici forniti, quindi determina il comportamento compatibile previsto e documenta o testa il risultato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Issue
CouchDb and PouchDb choose different indexes for a _find query that does not specify any index.
Is any of this to be expected, or am I doing something wrong? Thanks in advance.
And when trying to force use_index, Couch ignores it and Pouch errors. Seems like ignoring is the better route?
Info
- For pouch, using
pouchdb-node8,0.1 - Platform: Chrome
- Server: Both CouchDB 3.3.3 and PouchDB 8.0.1
Reproduce
Use the above server versions and a TypeScript client that uses http _find calls as described below:
I have a note document type, that looks like this:
{
"_id": "note:609ed703-ee69-46ec-8be2-4c70d25ad44e",
"_rev": "9-e1f3a3d98d32cbe361bf4ec0665071f9",
"type": "note",
"journal_id": "djrn:c669a908-b345-4ee4-9095-84babc8aea66",
"title": "2024-08-25 note",
"body": "Some text stuff\n",
"created_at": "2024-08-25",
"updated_at": "2024-08-26",
"tags": []
}
And when I do a _find (by tag matches), using this:
{
"selector": {
"type": {
"$in": [
"note"
]
},
"tags": {
"$in": [
"asdfasdfasdf",
"ddddddddd"
]
}
},
"fields": [
"_id",
"title",
"tags",
"updated_at"
],
}
It works fine, but when I use _explain I see that Couch and Pouch are using different indexes:
- CouchDb is using
type-indexbut - PouchDb is using
tags-index.
(I tried adding use_index, but it seems CouchDb ignores this, and PouchDb errors out (~"could not find the index, or could not use it for this query").
Here is an example of what the indexes look like; they are almost identical in Couch and Pouch:
type-index from PouchDb (same index is in Couch, except for id, rev):
{
"_id": "_design/idx-bae76d56ce6ab639848d59c2a1d8b364",
"language": "query",
"views": {
"type-index": {
"map": {
"fields": {
"type": "asc"
}
},
"reduce": "_count",
"options": {
"def": {
"fields": [
"type"
]
}
}
}
},
"_rev": "1-dd74d6c53ea6e913934d836695512a07"
}
tags-index from CouchDb (same index is in Pouch, except for id, rev):
{
"_id": "_design/723268ced4323d1b517d25ade1287381c0147cef",
"_rev": "1-cc3ee54469dd17f10c535366c2e1f972",
"language": "query",
"views": {
"tags-index": {
"map": {
"fields": {
"tags": "asc"
},
"partial_filter_selector": {}
},
"reduce": "_count",
"options": {
"def": {
"fields": [
"tags"
]
}
}
}
}
}
- Lingua principale
- JavaScript
- Stelle
- 17.6k
- Fork
- 1.5k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/pouchdb
-
elemMatch throws TypeError: value is null if array has null elementForse già presa @henyanagar l’ha presa 144 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Validate database namesAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
Tutte le issue di apache/pouchdb
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
hugomrdias/playwright-test#753 ·
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
KonstantinStarovoytov/kitden#21 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
guybedford/es-module-shims#556 ·
-
app ernst:4-klein
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
NewspeedyNL/PidLane#683 ·
I maintainer di solito rispondono entro 1 giorno