Created
May 6, 2019 16:12
-
-
Save kevinAlbs/f57517ea0118415a503724702aa6e0de to your computer and use it in GitHub Desktop.
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 update_cmd = | |
{ | |
update: "default", | |
updates: [ | |
{ q: {}, | |
u: { $set: {"y.$[i].b": 2} }, | |
arrayFilters: [ {"i.b": 4} ] | |
} | |
], | |
ordered: true, | |
jsonSchema: schema | |
} | |
printjson(db.runCommand(update_cmd)) | |
/* | |
Even though "y" is not an encrypted field, we get back: | |
{ | |
"ok" : 0, | |
"errmsg" : "No array filter found for identifier 'i' in path 'y.$[i].b'", | |
"code" : 2, | |
"codeName" : "BadValue" | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment