如何让mongodb验证报错指向字段名

How to make mongodb verify that the error report points to the field name

当我在集合上定义 JsonSchema 时,我认为数据无效,我可以看到哪个字段是错误的,但我得到的错误是:Document Failed Validation.

有什么方法可以查看文档的哪个字段?

mongoDB 的当前版本没有为您提供详细的 JSON 架构错误。您不能简单地使用 JSON Schema 的另一个实现来确定错误,因为 mongoDB 使用旧版本 JSON Schema 的修改版本。您可能想向他们提出支持请求。