我正在使用 Compass 的验证选项卡手动输入下面的 $jsonSchema 验证。不幸的是,它一直显示错误“未知 $jsonSchema 关键字:几何”
不确定为什么会显示此错误,因为几何图形被用作键。
请对我如何纠正这个问题有任何建议吗?
{
$jsonSchema: {
bsonType: "object",
required: ["properties.Name", "properties.Country", "geometry.type", "geometry.coordinates"],
properties:{
Country: {
bsonType: "string",
description: "Must be supplied"
},
Name: {
bsonType: "string",
description: "Must be supplied"
},
description: {
bsonType: "string",
description: "Optional description"
}
},
geometry: {
type: {
bsonType: "string",
enum: ["Point"],
description: "Must be Point"
},
coordinates: {
bsonType: ["double"],
description: "Longitude, Latitude"
}
},
datePosted: {
bsonType: "date",
description: "Auto-added field"
},
image: {
bsonType: "string",
description: "URL of image location"
}
}
}