upstash / issues

Issue Tracker for Upstash
https://upstash.com
2 stars 0 forks source link

JSON.SET only allows object creation at the root even if the XX flag is set #49

Open thekauer opened 1 year ago

thekauer commented 1 year ago

The following command errors on upstash. (doc does not exist before running the command.)

JSON.SET doc '$.a' '{"a":2}' XX

result in upstash: ERR new objects must be created at the root result using redislab - expected result: (nil)

sancar commented 1 year ago

@thekauer Thanks for reporting this.

I have tested both original redis, and our implementation.

Both does not allow setting objects at the root when XX is provided.

Our implementation returns error as if XX is not provided. Original Redis returns nil following this spec:

Return value
JSET.SET returns a simple string reply: OK if executed correctly or nil if the specified NX or XX conditions were not met. For more information about replies, see [Redis serialization protocol specification](https://redis.io/docs/reference/protocol-spec).

So the effects of both are same but how the error is reported is different. I will send a fix soon.

mdogan commented 1 year ago

This is now fixed in codebase, but I'll close the issue once it's deployed to all regions.