Last active
April 27, 2019 00:01
-
-
Save kevinAlbs/ff46583454de0308964fda7fce733803 to your computer and use it in GitHub Desktop.
mongocryptd returns upsert/multi as false
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 27017 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 = { | |
update: "coll", | |
updates: [{ q: {}, u: { ssn: "123" }, upsert: true, multi: true }], | |
jsonSchema: schema | |
}; | |
printjson(db.runCommand(cmd)) | |
/* Prints: | |
{ | |
"hasEncryptionPlaceholders" : true, | |
"schemaRequiresEncryption" : true, | |
"result" : { | |
"update" : "coll", | |
"updates" : [ | |
{ | |
"q" : { | |
}, | |
"u" : { | |
"ssn" : BinData(6,"AEkAAAAQYQABAAAABWl2ABAAAAAAaWlpaWlpaWlpaWlpaWlpaQVraQAQAAAABAAAAAAAAAAAAAAAAAAAAAACdgAEAAAAMTIzAAA=") | |
}, | |
"multi" : false, | |
"upsert" : false | |
} | |
], | |
"$db" : "test" | |
}, | |
"ok" : 1 | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment