Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

103
Views
How to use couchdb _find request with a number of selectors?

I'm trying to get documents for different selectors in one _find request. How is this possible to implement?

"selector": {
    "$or": [
        {"author": "007177e3-6719-4237-8903-fb397977889f"},
        {"writers": {"$regex": "007177e3-6719-4237-8903-fb397977889f"}},
        {"readers": {"$regex": "007177e3-6719-4237-8903-fb397977889f"}}
    ]
},
"use_index": "_design/5e0c1e3422759aefaa2aa14ed5a8323ba33f06e3",
"sort": [{"title": "asc"}],
"fields": ["_id", "_rev", "id", "title","author", "writers", "readers"]

Index used in request

{
        "ddoc": "_design/5e0c1e3422759aefaa2aa14ed5a8323ba33f06e3",
        "name": "title-json-index",
        "type": "json",
        "partitioned": false,
        "def": {
            "fields": [
                {
                    "title": "asc"
                }
            ]
        }
    },

In the response I only get document there author is "007177e3-6719-4237-8903-fb397977889f". Other selectors (writers, readers) are ignored.

Doc sample:

{
  "_id": "scheme-44b2b6f6-9b42-40b5-86c3-6135cde2f99f",
  "_rev": "6-bcbd906fd316e098fdd45eda3c11008f",
  "id": "scheme-44b2b6f6-9b42-40b5-86c3-6135cde2f99f",
  "title": "New scheme 25.02.2022",
  "scope": "meta",
  "created": "2022-02-25T05:43:45.546Z",
  "modified": "2022-03-04T04:09:25.659Z",
  "sharedUI": {
    "schemeSharingLock": false,
    "schemeRenameLock": false,
    "schemeDeleteLock": false
  },
  "author": "007177e3-6719-4237-8903-fb397977889f",
  "writers": "fff,007177e3-6719-4237-8903-fb397977889f,ccc",
  "readers": "yyyy",
}

CouchDB version: 3.2.0

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!