0

[ { "senderID": "64d9c926c17fd183a93d5e35", "receiverID": "64d9c92dc17fd183a93d5e39", "timestamp": "2023-08-14T07:39:45.946Z", "content": "bru", "status": "delivered", "type": "chat", "messageID": "8188946b-67e4-4d86-a927-32842361825c" }, ... ]

JSON.SET rooms:64d9c926c17fd183a93d5e35-64d9c92dc17fd183a93d5e39 $[?(@.status=='sent')].status "'delivered'"

Redis JSON Query Image on redis cli

I do get that error - Invalid argument(s): closing quote must be followed by a space or nothing at all

I have tried the variations of delivered and sent mentioned in the query with double quotes, single quotes, and both for the sake of it

Wrong Query? idk

1 Answers1

1

I think the problem is that your JSONPath has single quotes in it. Try wrapping it in double quotes. Like this:

JSON.SET rooms:64d9c926c17fd183a93d5e35-64d9c92dc17fd183a93d5e39 "$[?(@.status=='sent')].status" '"delivered"'

Also, I changed the string to use single quotes on the outside. Since double quotes are in JSON all over the place, I always wrap my JSON in single quotes. Just a good habit.

Guy Royse
  • 2,739
  • 12
  • 9
  • OMG that's so much, i don't realize that the condition itself needed the double quotes, you are awesome have a great years ahead, (i usually use double quotes on outside, i got this query when wandering in internet mybad} – Bruce Armstrong Aug 18 '23 at 05:44