Hello everyone,

We are building JS based application which storing data in CouchDb. It is a
greenfield application in case of front end and database structure. I would
use some examples at the beginning.

I have some selector which gets me data from db:

 const q = {
      selector: {
        historyId: document.historyId,
      },
      sort: [{ version: "desc" }],
      limit: 500,
    };


In the results I will get data along with warning:

"warning": "no matching index found, create an index to optimize query time"


I can easily get rid of that warning by adding using Fauxton index:

{
   "index": {
      "fields": [
         "historyId"
      ]
   },
   "name": "historyId-json-index",
   "type": "json"
}


My question is - How do you guys approach to working with indexes ? Should
I add it to each query which I'm doing ?

Thoughts about approaches would be much appreciated. :)

Thanks,
-- 

Piotr Zarzycki

Patreon: *https://www.patreon.com/piotrzarzycki
<https://www.patreon.com/piotrzarzycki>*

Reply via email to