db.getSiblingDB("joniel").runCommand({
collMod: "todo",
validator: {
$jsonSchema: {
bsonType: "object",
properties: {
title: {
encrypt: {
keyId: [UUID("33408ee9-e499-43f9-89fe-5f8533870617")],
algorithm: "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic",
bsonType: "string",
},
},
},
},
},
});
mongosh에서 명령을 날리니... 권한이 없다한다.
readWrite 권한으로는 안되는 것인가...
joniel> db.todo.find();
[
{ _id: ObjectId("6300a6f0405009fa5469c78a"), title: '엄니께 전화드리기' },
{ _id: ObjectId("6300a701405009fa5469c78b"), title: '우유와 라면사오기.' }
]
joniel> db.getSiblingDB("joniel").runCommand({ collMod: "todo", validator: { $jsonSchema: { bsonType: "object", properties: { title: { encrypt: { keyId: [UUID("33408ee9-e499-43f9-89fe-5f8533870617")], algorithm: "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", bsonType: "string" } } } } } });
MongoServerError: not authorized on joniel to execute command { collMod: "todo", validator: { $jsonSchema: { bsonType: "object", properties: { title: { encrypt: { keyId: [ UUID("33408ee9-e499-43f9-89fe-5f8533870617") ], algorithm: "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", bsonType: "string" } } } } },
lsid: { id: UUID("a85db819-1e81-4f76-a909-ccb63ad9e216") }, $db: "joniel" }