【发布时间】:2021-12-23 06:03:29
【问题描述】:
试图弄清楚如何验证对象数组和映射(键,值)对
{
"commonIdentification": {
"CR": "BR",
"SN": "NAVS87397394"
}
"digitalIdentiifcation": {
"UUID": "326f040b-cf14-4cf9-9e67-57f7ca3ce1b2"
}
}
在这里,我想添加验证,
- 通常识别存在 CR,不需要数字识别的存在
- 在没有 CR 的常见标识中,需要 digitalIdentiifcation 的“UUID”字段。
任何人都可以帮助重新格式化验证部分吗?我正在努力根据上述几点进行验证。
{
$jsonSchema: {
properties: {
commonIdentification: {
type: 'object',
required: [
'CR'
],
properties: {
CR: {
type: 'string',
description: 'CR is mandatory '
}
}
}
},
type: 'object',
required: [
'commonIdentification',
'digitalIdentiifcation'
]
}
}
【问题讨论】:
标签: mongodb validation mongodb-query