Bug #79053 Second argument "one" to JSON_CONTAINS_PATH is a misnomer
Submitted: 1 Nov 2015 3:18 Modified: 1 Nov 2015 11:42
Reporter: Roland Bouman Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: JSON Severity:S3 (Non-critical)
Version:5.7.9 OS:Any
Assigned to: CPU Architecture:Any

[1 Nov 2015 3:18] Roland Bouman
Description:
https://dev.mysql.com/doc/refman/5.7/en/json-search-functions.html#function_json-contains-...

According to docs, second argument can be:

'one': 1 if at least one path exists within the document, 0 otherwise.

'all': 1 if all paths exist within the document, 0 otherwise.

This is a false dichotomy. From a logical perspective there is one case missing: "some", which should mean: "at least one". The result "one" should be reserved for "exactly one, no more, no less".

So my proposal is to introduce "some" and make that behave the way "one" is behaving currently, and to make "one" return true only when there is exactly 1 path that matches the specified path or paths.

As a matter of convenience, it would be nice to also add "none" as an option, to make it easy to check of a particular path is certainly not present in the document. 

How to repeat:
N/A

Suggested fix:
N/A
[1 Nov 2015 11:42] Umesh Shastry
Hello Roland,

Thank you for the feedback.

Thanks,
Umesh