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/08/20 08:31:08 UTC

[GitHub] [couchdb-documentation] olcoz8 opened a new issue #583: Generate view and query for nested dictionary in document

olcoz8 opened a new issue #583:
URL: https://github.com/apache/couchdb-documentation/issues/583


   Generate view and query for nested dictionary in document
   
   ## Expected Behavior
   Having documents following this schema:
   
   ```
   {
     "_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
     "_rev": "x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
   
     "field_1": "something",
     "field_2": "something",
     "field_3": "something",
   
     "field_of_interest": {
       "id-0": {
         "own_id": "id-0",
         "sub_field_of_interest": "data_a",
         "other_sub_field": "something"
       },
       "id-1": {
         "own_id": "id-1",
         "sub_field_of_interest": "data_b",
         "other_sub_field": "something"
       }
     },
   
     "field_4": something
   }
   ```
   It might be possible to create a view emitting a sub-field of the nested dictionary of the document for getting a query like this:
   
   ```
   "data_a": "id-0"
   "data_b": "id-1"
   ```
   
   ## Current Behavior
   
   I didn't find any option for working with nested dictionaries. All the references similar to this issue addressed nested lists in the document, not a nested dictionary.
   
   ## Possible Solution
   
   Is it possible to work with views and queries with this kind of documents?
   
   ## Your Environment
   Currently, I am working with couchdb through the Python library for Cloudant and CouchDB.


----------------------------------------------------------------
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-documentation] rjharmon commented on issue #583: Generate view and query for nested dictionary in document

Posted by GitBox <gi...@apache.org>.
rjharmon commented on issue #583:
URL: https://github.com/apache/couchdb-documentation/issues/583#issuecomment-677767645


   Agree.  Would like to be able to address the values in a dictionary (object) field `items` with same selector semantics as arrays.  If we could address `items.$values` as array-like, and use $elemMatch/$allMatch on it, that would be great.  
   
   Although a map/reduce index can iterate the values and emit() items to an index (then query with startkey/endkey), accessing the same with a JSON Mango index would be tres helpful.  
   
   Alternatively: Is there any semantics/metadata that could be applied to such a view-definition, that would give Mango some kind of access to the map index, perhaps with a spoofed fieldname that can be used in Mango query?
   


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