skip to Main Content

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"
    }
}

2

Answers


  1. 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.

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search