[英]Alternative to schema validation in AWS DocumentDB
I am moving my database in MongoDB to AWS DocumentDB.我正在将 MongoDB 中的数据库移动到 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.我在Java中使用
mongodb-driver
(版本3.6.4)写入和读取数据,以及配置我使用的collections。 In particular, I have a schema validation (written as a JSON Schema) which seems not to be compatible with AWS DocumentDB.特别是,我有一个模式验证(写为 JSON 模式),它似乎与 AWS DocumentDB 不兼容。
Here the documentation says that $jsonSchema
is not supported, but I have not seen any explicit assertion about document validation in general. Here the documentation says that
$jsonSchema
is not supported,但我还没有看到任何关于一般文档验证的明确断言。
Is it really unsopported?真的不支持吗? Is there any alternative (besides doing it in the Java code)?
有没有其他选择(除了在 Java 代码中执行)?
As pointed out by smthakur19 in a comment above and as I expected, DocumentDB does not have the notion of required properties.正如 smthakur19 在上面的评论中所指出的以及我所预料的那样,DocumentDB 没有必需属性的概念。 However, it does have pre-triggers (eg 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.
因此,可以验证存储过程中的字段并拒绝在给定文档类型中不包含所需属性的插入。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.