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 2020/07/01 02:53:20 UTC

[GitHub] [couchdb] hamiltonsalazar opened a new issue #2976: Error with "Implicit Operators"

hamiltonsalazar opened a new issue #2976:
URL: https://github.com/apache/couchdb/issues/2976


   [NOTE]: # ( ^^ Provide a general summary of the issue in the title above. ^^ )
   
   ## Description
   
   I'm putting on practice the CouchDB documentation and I read about ["Implicit Operators"](https://docs.couchdb.org/en/stable/api/database/find.html#implicit-operators), but COUCHD ignore my firts condiction when i send two condictions and it should use the implicit `$and` operartor
   
   
   [NOTE]: # ( Describe the problem you're encountering. )
   [TIP]:  # ( Do NOT give us access or passwords to your actual CouchDB! )
   
   ## Current Behavior
   
   I use the next query:
   ```
   {     
       "selector" : {        
           "age": {
               "$lte": 30
           },
           "age": {
               "$gte": 25
           }
       },    
       "fields": [   "name",   "age",    "_id"     ], 
       "sort": [
           {
               "age": "desc"
           }   
       ]
   }
   ```
   
   But COUCHDB is ignoring my firts condition:
   
   > {"docs":[
   {"name":"Erick","age":70,"_id":"9578"},
   {"name":"Lucas","age":70,"_id":"9269"},
   {"name":"Valeria","age":70,"_id":"9016"},
   {"name":"Pablo","age":70,"_id":"8963"},
   {"name":"Lucas","age":70,"_id":"8592"},
   {"name":"Olivia","age":70,"_id":"8557"},
   {"name":"Paula","age":70,"_id":"7961"},
   {"name":"Adrián","age":70,"_id":"7653"},
   {"name":"Isla","age":70,"_id":"7615"},
   {"name":"Javier","age":70,"_id":"6625"},
   {"name":"Daniel","age":70,"_id":"640"},
   {"name":"Alice","age":70,"_id":"6318"},
   {"name":"Chloe","age":70,"_id":"6118"},
   {"name":"Benjamín","age":70,"_id":"5713"},
   {"name":"Adeline","age":70,"_id":"5674"},
   {"name":"David","age":70,"_id":"5572"},
   {"name":"Nicolás","age":70,"_id":"5289"},
   {"name":"Thiago","age":70,"_id":"5232"},
   {"name":"Julián","age":70,"_id":"5137"},
   {"name":"Dulce","age":70,"_id":"4738"},
   {"name":"Valeria","age":70,"_id":"4699"},
   {"name":"Sofía","age":70,"_id":"4389"},
   {"name":"Matías","age":70,"_id":"4323"},
   {"name":"Evelyn","age":70,"_id":"4248"},
   {"name":"Carlos","age":70,"_id":"4192"}
   ],
   "bookmark": "g2wAAAACaAJkAA5zdGFydGtleV9kb2NpZG0AAAAENDE5MmgCZAAIc3RhcnRrZXlrAAFGag"}
   
   
   And changing the condictions: 
   ```
   {     
       "selector" : {    
           "age": {
               "$gte": 25
           },
           "age": {
               "$lte": 30
           }
       },    
       "fields": [   "name",   "age",    "_id"     ], 
       "sort": [
           {
               "age": "asc"
           }   
       ]
   }
   ```
    
   CouchDB also ignored my firts condiction: 
   
   > {"docs":[
   {"name":"Amalia","age":18,"_id":"5642"},
   {"name":"Evelyn","age":18,"_id":"6528"},
   {"name":"Eleanor","age":18,"_id":"7476"},
   {"name":"Dulce","age":18,"_id":"8990"},
   {"name":"Valentín","age":18,"_id":"9755"},
   {"name":"Valeria","age":19,"_id":"1016"},
   {"name":"Jorge","age":19,"_id":"1164"},
   {"name":"Evelyn","age":19,"_id":"1172"},
   {"name":"Erick","age":19,"_id":"1246"},
   {"name":"Cora","age":19,"_id":"1385"},
   {"name":"Pablo","age":19,"_id":"146"},
   {"name":"Samantha","age":19,"_id":"1633"},
   {"name":"Marcos","age":19,"_id":"1645"},
   {"name":"Regina","age":19,"_id":"1758"},
   {"name":"Charlotte","age":19,"_id":"1797"},
   {"name":"Marcos","age":19,"_id":"21"},
   {"name":"Álvaro","age":19,"_id":"2271"},
   {"name":"Eleanor","age":19,"_id":"2283"},
   {"name":"Thiago","age":19,"_id":"230"},
   {"name":"Adrián","age":19,"_id":"2401"},
   {"name":"Samantha","age":19,"_id":"2681"},
   {"name":"Ava","age":19,"_id":"2863"},
   {"name":"Julia","age":19,"_id":"287"},
   {"name":"Daniela","age":19,"_id":"2912"},
   {"name":"Pablo","age":19,"_id":"296"}
   ],
   "bookmark": "g2wAAAACaAJkAA5zdGFydGtleV9kb2NpZG0AAAADMjk2aAJkAAhzdGFydGtleWsAARNq"}
   
   
   [NOTE]: # ( Include commands to reproduce, if possible. curl is preferred. )
   
   ## Expected Behaviour
   
   COUCHD should response with:
   
   > {"docs":[
   > {"name":"Cora","age":25,"_id":"104"},
   > {"name":"Pablo","age":25,"_id":"11"},
   > {"name":"Daniela","age":25,"_id":"1192"},
   > {"name":"Sim├│n","age":25,"_id":"1305"},
   > {"name":"Amalia","age":25,"_id":"1358"},
   > {"name":"Benjamín","age":25,"_id":"1488"},
   > {"name":"Cora","age":25,"_id":"1599"},
   > {"name":"Pablo","age":25,"_id":"1722"},
   > {"name":"Benjamín","age":25,"_id":"1781"},
   > {"name":"Mario","age":25,"_id":"1798"},
   > {"name":"Elizabeth","age":25,"_id":"2"},
   > {"name":"Daniel","age":25,"_id":"2060"},
   > {"name":"Adrián","age":25,"_id":"209"},
   > {"name":"Chloe","age":25,"_id":"2173"},
   > {"name":"Elizabeth","age":25,"_id":"2211"},
   > {"name":"Álvaro","age":25,"_id":"2237"},
   > {"name":"Samantha","age":25,"_id":"2281"},
   > {"name":"Marcos","age":25,"_id":"2334"},
   > {"name":"Iván","age":25,"_id":"2409"},
   > {"name":"Benjamín","age":25,"_id":"2523"},
   > {"name":"Matías","age":25,"_id":"2772"},
   > {"name":"Eleanor","age":25,"_id":"2781"},
   > {"name":"Valentín","age":25,"_id":"2926"},
   > {"name":"Paula","age":25,"_id":"2927"},
   > {"name":"Mario","age":25,"_id":"2958"}
   > ],
   > "bookmark": "g2wAAAACaAJkAA5zdGFydGtleV9kb2NpZG0AAAAEMjk1OGgCZAAIc3RhcnRrZXlrAAEZag"}
   
   
   But I only can get this with Explicit Operators:
   ```
   {     
       "selector" : {    
           "$and": [
               {
                   "age": {        
                       "$gte": 25    
                   }
               },    
               {
                   "age": {        
                       "$lte": 30    
                   }
               } 
           ]
       },    
       "fields": [   "name",   "age",    "_id"     ], 
       "sort": [
           {
               "age": "asc"
           }   
       ]
   }
   ```
   
   
   ## Your Environment
   
   [TIP]:  # ( Include as many relevant details about your environment as possible. )
   [TIP]:  # ( You can paste the output of curl http://YOUR-COUCHDB:5984/ here. )
   
   * CouchDB version used: 3.1.0
   * Operating system and version: Windows 10 Pro 1909
   


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



[GitHub] [couchdb] wohali closed issue #2976: Error with "Implicit Operators"

Posted by GitBox <gi...@apache.org>.
wohali closed issue #2976:
URL: https://github.com/apache/couchdb/issues/2976


   


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