I have been trying to get the keys I have generated with this repo https://github.com/mongodb-developer/python-quickstart-code and it is really useful for creating keys in python, however how do you get a key for an altname?
I thought perhaps it is best to try running commands like: db.command("getKeyByAltName", keyAltName="nameofkeyaltnameadmin")
but I get the error getKeyByAltName does not exist:
pymongo.errors.OperationFailure: no such command: 'getKeyByAltName', full error: {'ok': 0.0, 'errmsg': "no such command: 'getKeyByAltName'", 'code': 59, 'codeName': 'CommandNotFound'}
even though it definitely does according to the docs https://www.mongodb.com/docs/v4.2/reference/method/KeyVault.getKeyByAltName/ can anyone help me with this? I am a bit stuck...
My mongodb version is:
db version v6.0.3
Build Info: {
"version": "6.0.3",
"gitVersion": "f803681c3ae19817d31958965850193de067c516",
"modules": [],
"allocator": "tcmalloc",
"environment": {
"distmod": "windows",
"distarch": "x86_64",
"target_arch": "x86_64"
}
}
CodePudding user response:
getKeyByAltName
is a method of a KeyVault object. It is a client-side field level encryption method.
db.command is for running database commands on the server.
CodePudding user response:
This method should be in a ClientEncryption object (see for example a test here), I'm not a python developer, but getKeyByAltName should be there