You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2019/06/29 12:40:31 UTC

[GitHub] [couchdb] garrensmith commented on issue #2063: index with $or operator not working

garrensmith commented on issue #2063: index with $or operator not working
URL: https://github.com/apache/couchdb/issues/2063#issuecomment-506954084
 
 
   The simplest is just creating an index on type. The add in the execution stats to see how many docs are ignored or not.
   
   
   ________________________________
   From: brifai <no...@github.com>
   Sent: Saturday, June 29, 2019 12:19 PM
   To: apache/couchdb
   Cc: Subscribed
   Subject: Re: [apache/couchdb] index with $or operator not working (#2063)
   
   
   thank you @wohali<https://github.com/wohali> for the reply.
   the index is as following:
   
   {
           "index": {
                   "fields": [
                           "type",
                           "pmId",
                           "sponsor._id",
                           "AccessMembers.[].id",
                           "AccessMembers.[].ACL"
                   ]
           },
           "name": "pm-projects-index",
           "type": "json"
   }
   
   
   the "explain" result as following:
   
   {
    "dbname": "pm",
    "index": {
     "ddoc": null,
     "name": "_all_docs",
     "type": "special",
     "def": {
      "fields": [
       {
        "_id": "asc"
       }
      ]
     }
    },
    "selector": {
     "$and": [
      {
       "type": {
        "$eq": "project"
       }
      },
      {
       "$or": [
        {
         "pmId": {
          "$eq": "8b1cee44bf16ccced9163adee20008a8"
         }
        },
        {
         "sponsor._id": {
          "$eq": "8b1cee44bf16ccced9163adee20008a8"
         }
        },
        {
         "AccessMembers": {
          "$elemMatch": {
           "$and": [
            {
             "id": {
              "$eq": "8b1cee44bf16ccced9163adee20008a8"
             }
            },
            {
             "ACL": {
              "$in": [
               "View",
               "Edit"
              ]
             }
            }
           ]
          }
         }
        }
       ]
      }
     ]
    },
    "opts": {
     "use_index": [],
     "bookmark": "nil",
     "limit": 25,
     "skip": 0,
     "sort": {},
     "fields": "all_fields",
     "r": [
      49
     ],
     "conflicts": false,
     "stale": false,
     "update": true,
     "stable": false,
     "execution_stats": false
    },
    "limit": 25,
    "skip": 0,
    "fields": "all_fields",
    "mrargs": {
     "include_docs": true,
     "view_type": "map",
     "reduce": false,
     "start_key": null,
     "end_key": "",
     "direction": "fwd",
     "stable": false,
     "update": true,
     "conflicts": "undefined"
    }
   }
   
   
   —
   You are receiving this because you are subscribed to this thread.
   Reply to this email directly, view it on GitHub<https://github.com/apache/couchdb/issues/2063?email_source=notifications&email_token=AABL2AUWVGULUJD6MCB3U3DP44ZKPA5CNFSM4H3Z4I5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY3WGBY#issuecomment-506946311>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AABL2ASF4FIGXFGCE3SVY6DP44ZKPANCNFSM4H3Z4I5A>.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services