5

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)?

AugSB
  • 249
  • 1
  • 5
  • 16
  • 1
    An alternative is provided on the below link, https://stackoverflow.com/questions/39510903/how-to-design-a-basic-schema-in-document-dbnosql – smthakur19 Aug 18 '21 at 07:32
  • @smthakur19 your comment is for Azure and not AWS – Yuki Nov 15 '21 at 07:35
  • @Yuki the question is about having MongoDB schema-validator in AWS DocumentDB. I have included AWS documentation link for the same reference. Let me know for further inputs. – smthakur19 Nov 28 '21 at 08:57

1 Answers1

0

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.

AugSB
  • 249
  • 1
  • 5
  • 16