127.0.0.1:6379> JSON.GET store $..headphones[?(@price<70&&@wireless==true)]
[{"id":12346,"name":"Wireless earbuds","description":"Wireless Bluetooth in-ear headphones","wireless":true,"connection":"Bluetooth","price":64.99,"stock":17,"free-shipping":false,"colors":["black","white"]}]
127.0.0.1:6379> JSON.GET store $.inventory.*[?(@.connection=="Bluetooth")].name Invalid argument(s) 127.0.0.1:6379> JSON.GET store '$.inventory.*[?(@.connection=="Bluetooth")].name' ["Noise-cancelling Bluetooth headphones","Wireless earbuds","Wireless keyboard"]
This example, starting with version v2.4.2, filters only keyboards with some sort of USB connection using regex match. Notice this match is case-insensitive thanks to the prefix (?i) in the regular expression pattern "(?i)usb":
127.0.0.1:6379> JSON.GET store '$.inventory.keyboards[?(@.connection =~ "(?i)usb")]'
[{"id":22346,"name":"USB-C keyboard","description":"Wired USB-C keyboard","wireless":false,"connection":"USB-C","price":29.99,"stock":30,"free-shipping":false}]

浙公网安备 33010602011771号