Skip to content

Conversation

adiholden
Copy link
Contributor

fixes #4936

kostasrim
kostasrim previously approved these changes Apr 15, 2025
@@ -1274,6 +1274,8 @@ std::vector<std::optional<std::string>> OpJsonMGet(const WrappedJsonPath& json_p
json_val, std::move(cb), CallbackResultOptions::DefaultEvaluateOptions());

if (eval_result.IsV1()) {
if (eval_result.Empty())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be we should also return nullopt for V2. Let me check

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we now have the correct behavior:
snippet from redis:

127.0.0.1:6379> json.set json1 . '{"text":"some text"}'
OK
127.0.0.1:6379> json.set json2 . '{"text":"another text"}'
OK
127.0.0.1:6379> json.mget json1 json2 .[0]
1) (nil)
2) (nil)
127.0.0.1:6379> json.mget json1 json2 $.[0]
1) "[]"
2) "[]"

Signed-off-by: adi_holden <[email protected]>
Signed-off-by: adi_holden <[email protected]>
@BagritsevichStepan
Copy link
Contributor

You just need to update output of the Json mget command. It skips for now nullable values

Signed-off-by: adi_holden <[email protected]>
@romange romange merged commit b86b692 into main Apr 15, 2025
10 checks passed
@romange romange deleted the fix_4936 branch April 15, 2025 18:56
romange pushed a commit that referenced this pull request Apr 17, 2025
* server: fix json mget crash on invalid path

---------

Signed-off-by: adi_holden <[email protected]>
romange pushed a commit that referenced this pull request Apr 17, 2025
* server: fix json mget crash on invalid path

---------

Signed-off-by: adi_holden <[email protected]>
kostasrim pushed a commit that referenced this pull request Apr 22, 2025
* server: fix json mget crash on invalid path

---------

Signed-off-by: adi_holden <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dragonfly crashes on json.mget command
4 participants