|
Author:
{u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}
Message: SERVER-15456 relax validation of 'query' field for count command
Branch: master
https://github.com/mongodb/mongo/commit/f4514b50d9c4d8509c6108b2c17d021c2aee7d82
|
|
2.6 is very lenient:
> db.runCommand({count : "test", query : {}} )
|
{ "n" : 2, "ok" : 1 }
|
> db.runCommand({count : "test", query : null} )
|
{ "n" : 2, "ok" : 1 }
|
> db.runCommand({count : "test", query : 1} )
|
{ "n" : 2, "ok" : 1 }
|
> db.runCommand({count : "test", query : false} )
|
{ "n" : 2, "ok" : 1 }
|
> db.runCommand({count : "test", query : "f"} )
|
{ "n" : 2, "ok" : 1 }
|
|
|
I don't see any relation between null and false. Null means no value, which many languages would interpret, as Gustavo said, as undefined/not present. False means false. It has a value and it means something very specific. This is very different from null in my opinion.
|
|
The usual none/null/nil values are a common way to spell "undefined" in the respective languages that accept those values, so idioms are created exploring that expectation. I also don't really mind either way, as the Go driver is even fixed to not touch the edge case by now, but it doesn't sound like we should worry about people that expect "false" to work as a query. This is already an error, isn't it?
|
|
It's worth pointing out that the "non-Object values" that drivers might pass is really just null, meaning undefined, so there's no need to accept completely bogus data.
|
Generated at Thu Feb 08 03:38:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.