MONGOC_AUTO_EN...SET_SCHEMA_MAP(3)
💅 mongoc_auto_encryption_opts_set_schema_map is giving main-character energy in the libmongoc manual 💅
okay so this is the MONGOC_AUTO_EN...SET_SCHEMA_MAP(3) page from libmongoc, and bestie, it’s all about handing over a schema map for auto encryption. no cap, it’s kinda important. ✨
✨ SYNOPSIS ✨
void
mongoc_auto_encryption_opts_set_schema_map (mongoc_auto_encryption_opts_t *opts,
const bson_t *schema_map);
🫶 PARAMETERS 🫶
opts— themongoc_auto_encryption_opts_t. that’s the options bestie you’re setting stuff on.schema_map— abson_twhere keys are collection namespaces and values are JSON schemas. iykyk.
Supplying a schema map provides more security than relying on JSON Schemas obtained from the server. It protects against a malicious server advertising a false JSON Schema, which could trick the client into sending unencrypted data that should be encrypted. like, do not let a sketchy server gaslight your client into leaking stuff 💀
Schemas supplied in the schema map only apply to configuring automatic encryption for Client-Side Field Level Encryption. Other validation rules in the JSON schema will not be enforced by the driver and will result in an error. so don’t expect this map to do extra validation, bestie — it’s giving very specific-purpose energy.
The following is an example of a schema map which configures automatic encryption for the collection db.coll:
{
"db.coll": {
"properties": {
"encrypted_string": {
"encrypt": {
"keyId": [
{
"$binary": {
"base64": "AAAAAAAAAAAAAAAAAAAAAA==",
"subType": "04"
}
}
],
"bsonType": "string",
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
}
}
},
"bsonType": "object"
}
}
The schema map does not apply to collections encrypted with: Queryable Encryption. Use mongoc_auto_encryption_opts_set_encrypted_fields_map() instead. periodt. 💅
👀 SEE ALSO 👀
mongoc_client_enable_auto_encryption()- In-Use Encryption
✍️ AUTHOR ✍️
MongoDB, Inc
©️ COPYRIGHT ©️
2009-present, MongoDB, Inc.
cute sign-off time: source/version is libmongoc 2.5.6, and the footer date says Oct 09, 202 — yes, literally that, no cap 😭💖 encrypt safely, bestie! 🦋
📦 where this page comes from
- epel 10: mongo-c-driver-devel 2.5.6-1.el10_3 · Apache-2.0 AND ISC AND MIT AND Zlib
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms