Last active
May 6, 2019 19:10
-
-
Save kevinAlbs/ddd7ecd610589bf978f5798b8210f23e to your computer and use it in GitHub Desktop.
mongocryptd reorders values in $in array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* start mongocryptd, then do: | |
* mongo --port 27020 repro.js | |
*/ | |
var schema = { | |
properties: { | |
ssn: { | |
encrypt: { | |
keyId: [ | |
BinData(4, "AAAAAAAAAAAAAAAAAAAAAA==") | |
], | |
bsonType: "string", | |
algorithm: "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", | |
initializationVector: BinData(0, "aWlpaWlpaWlpaWlpaWlpaQ==") | |
} | |
} | |
}, | |
bsonType: "object" | |
}; | |
var cmd= | |
{ | |
find: "default", | |
filter: {ssn: { $in: ["aaaaaaaaaaaaaaa", "a"]}}, | |
jsonSchema: schema | |
} | |
printjson(db.runCommand(cmd)) | |
/* | |
Prints: | |
{ | |
"hasEncryptionPlaceholders" : true, | |
"schemaRequiresEncryption" : true, | |
"result" : { | |
"find" : "default", | |
"filter" : { | |
"ssn" : { | |
"$in" : [ | |
BinData(6,"AEcAAAAQYQABAAAABWl2ABAAAAAAaWlpaWlpaWlpaWlpaWlpaQVraQAQAAAABAAAAAAAAAAAAAAAAAAAAAACdgACAAAAYQAA"), | |
BinData(6,"AFUAAAAQYQABAAAABWl2ABAAAAAAaWlpaWlpaWlpaWlpaWlpaQVraQAQAAAABAAAAAAAAAAAAAAAAAAAAAACdgAQAAAAYWFhYWFhYWFhYWFhYWFhAAA=") | |
] | |
} | |
} | |
}, | |
"ok" : 1 | |
} | |
Note order of short/long marking. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment