|
mongocryptd rewrites "$eq" and "$in" expressions using "$gte" and "$lte" of the same value.
E.g.
is rewritten as
{"$and": [{"value": {"$gte": 123}}, {"value": {"$lte": 123 }}]}
|
And:
{"value": {"$in": [123, 124]}}
|
is rewritten as
{"$or": [
|
{"$and": [{"value": {"$gte": 123}}, {"value": {"$lte": 123 }}]}
|
{"$and": [{"value": {"$gte": 124}}, {"value": {"$lte": 124 }}]}
|
]}
|
The existing output can be used to build the same expressions:
# Do an equality match for value 123.
|
got = clientEncryption.encryptExpression ({"$and": [{"value": {"$gte": 123, {"value": {"$lte": 123 }}]}, opts)
|
coll.find_one (got)
|
Updating to mark as a "New Feature". There is a workaround. Supporting "$eq" and "$in" in explicit encryption may be a useful convenience.
|