RedisJSON / redisjson-py

An extension to redis-py for using Redis' ReJSON module
https://redisjson.io
BSD 2-Clause "Simplified" License
160 stars 34 forks source link

How to retrieve a subset of key, vals #58

Closed aammundi closed 3 years ago

aammundi commented 3 years ago
   obj = {
       'answer': 42,
       'arr': [None, True, 3.14],
       'truth': {
           'coord': 'out there'
       }
   }

Is there any way for me to specify a set of paths to enable something like:

jsonmget(path=Path(['.answer', '.arr']), 'obj')

=> ``` [ 'answer': 42, 'arr': [None, True, 3.14]]

gkorland commented 3 years ago

jsonmget is not meant for multi paths but for multi keys: JSON.MGET <key> [key ...] <path>

To get multi paths all you need to do is send a union path(v2.0.0+):

$.["answer","arr"]

aammundi commented 3 years ago

thanks very much