有没有办法定义 MongoDB JSONSchema 进行验证,其中 Document 具有递归性质。
例如:我的用例是评论中可以包含嵌套评论。
{ "$jsonSchema": { "bsonType": "object", "properties": { "comment": { "bsonType": "array", "uniqueItems": true, "additionalProperties": false, "items": { “bsonType”:“object”,“properties”:{“user”:{“bsonType”:“string”},“message”:{“bsonType”:“bool”},“comment”:{“bsonType”: “???我怎样才能将它转换为递归类型”} } } } } } }
我如何为此定义一个 $jsonSchema。请帮忙