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 2021/11/10 21:50:55 UTC

[GitHub] [couchdb] pip25 opened a new issue #3826: "$all" query returns less results than an equivalent "$elemMatch" query

pip25 opened a new issue #3826:
URL: https://github.com/apache/couchdb/issues/3826


   
   ## Description
   
   We have a database containing only a few hundred records, each with a few dozen fields, usually with multiple attachments. We noticed that some queries were behaving strangely, and narrowed the problem down to the "$all" operator. The following two Mango queries, by my understanding, should produce the exact same results:
   
   ```json
   {
      "selector": {
         "number_array_field": {
            "$all": [
               602
            ]
         }
      }
   }
   ```
   
   ```json
   {
      "selector": {
         "number_array_field": {
            "$elemMatch": {
               "$eq": 602
            }
         }
      }
   }
   ```
   
   However, the query with "$all" actually returns less than half the results, missing documents that very obviously contain the number in the array field. (We of course don't always use queries with only a single argument for "$all", but this was the scenario where the issue was discovered.)
   
   ## Steps to Reproduce
   
   I tried creating a test database for reproducing the issue, but unfortunately the "$all" query works fine with simpler test data. While I of course can't provide a copy of our production DB, I can run further queries on it if it helps to narrow down the problem.
   
   ## Expected Behaviour
   
   The "$all" operator should return all records which contain the given number as part of the array field.
   
   ## Your Environment
   
   * CouchDB version used: Issue appears both on 3.2.0 and 3.1.0 
   * Browser name and version: Tested on Vivaldi (Chrome-based)
   * Operating system and version: Linux VM
   
   
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb] big-r81 commented on issue #3826: "$all" query returns less results than an equivalent "$elemMatch" query

Posted by GitBox <gi...@apache.org>.
big-r81 commented on issue #3826:
URL: https://github.com/apache/couchdb/issues/3826#issuecomment-1033999763


   Hi,
   
   can you give an example dataset, for which both queries gives different results?


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org