'Alternative to schema validation in AWS DocumentDB

I am moving my database in MongoDB to AWS DocumentDB. I am using mongodb-driver (version 3.6.4) in Java to write and read the data, as well as to configure the collections I use. In particular, I have a schema validation (written as a JSON Schema) which seems not to be compatible with AWS DocumentDB.

Here the documentation says that $jsonSchema is not supported, but I have not seen any explicit assertion about document validation in general.

Is it really unsopported? Is there any alternative (besides doing it in the Java code)?



Solution 1:[1]

As pointed out by smthakur19 in a comment above and as I expected, DocumentDB does not have the notion of required properties. However, it does have pre-triggers (e.g. one that runs a stored procedure prior to performing an insert). So it is possible to validate fields within a stored procedure and reject inserts that do not contain required properties in a given document type.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 AugSB