[DRIVERS-2358] Update Ambiguous Top-Level Storage Error For CSLE remove_alt_name Created: 15/Jun/22  Updated: 07/Jul/22  Resolved: 07/Jul/22

Status: Closed
Project: Drivers
Component/s: Client Side Encryption
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Preston Vasquez Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Driver Changes: Not Needed

 Description   

Summary

Top-level dollar signs are not supported in mongodb versions < 4.2, per the legacy documentation. A recent change to key management API (in DRIVERS-2017) added a dependency on aggregation pipeline style update operators which are not supported until 4.2. Apps that attempt to use removeKeyAltName() on MongoDB <4.2 will receive a cryptic error like this:

The dollar ($) prefixed field '$set' in '0.$set' is not valid for storage.

This particular error will occur when running something like the following for a mongodb version < 4.2:

def remove_alt_name(name):
    return coll.find_one_and_update({"keyAltNames": name}, [{"$set": { "x": 1 }}])

One potential update could ensure the resulting error reads

FLE requires mongodb version 4.2+: The dollar ($) prefixed field '$set' in '0.$set' is not valid for storage.

Motivation

Who is the affected end user?

Anyone using version < 4.2 for aggregating data.

How does this affect the end user?

Cosmetic, clearer error messages for resolution.


Generated at Thu Feb 08 08:25:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.