4 / 4
Aug 2024

I’m using Automatica Queryable Encryption and trying to encrypt a field that is on an object in an array

This is an example of my schema

const sampleSchema = { encryptedFields: { fields: [ { path: 'primaryField', bsonType: 'string', queries: { queryType: 'equality' }, }, { path: 'secondaryField', bsonType: 'string', queries: { queryType: 'equality' }, }, { path: 'tertiaryField', bsonType: 'string', queries: { queryType: 'equality' }, }, { path: 'detailsObject', bsonType: 'object', }, { path: 'arrayField.arrayObjectField1', bsonType: 'string', queries: { queryType: 'equality' }, }, ], }, };``` This is an example of what I'm trying to insert

const sampleDocumentToInsert = {
id: ‘a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6’,
createdAt: ‘2024-08-05T07:25:49Z’,
arrayField: [
{
id: ‘q7r8s9t0-u1v2-w3x4-y5z6-a7b8c9d0e1f2’,
arrayObjectField1: ‘Example Case vs XYZ Corporation’,
additionalField1: ‘1234.5678’,
arrayObjectField2: { /* details of the requester / },
additionalField2: [ /
array of related processes */ ]
}
],
primaryField: ‘Example Company Inc.’,
secondaryField: ‘1234567890’,
additionalField3: ‘0987654321’,
tertiaryField: ‘info@examplecompany.com’,
additionalField4: ‘Business’,
detailsObject: {
subField1: ‘12345’,
subField2: ‘Main Street’,
subField3: ‘Anytown’,
subField4: ‘ST’,
subField5: ‘67890’,
subField6: ‘’,
subField7: ‘US’,
subField8: ‘12345 Main Street, Anytown, ST 67890’
},
additionalField5: ‘org_a1b2c3d4e5f6g7h8i9j0k1l2’
};

The error I'm seeing is ` MongoCryptError: csfle "analyze_query" failed: An array at path 'arrayField' would violate the schema` Is this the correct way to setup the validation schema if I want to encrypt a field in an object that will be in an array of objects as in `arrayField` for Automatica Queryable Encryption?

Good to know thanks. Is there a public road map somewhere that can be referenced? This way I can structure and plan queries and collection schemas accordingly.

I don’t publish a public roadmap on the www because I have to be agile in what I prioritize. For queryable encryption, I’m hoping to deliver array support in 2025 because we’re focusing on some other core QE features in our current development cycles.