如何使用MongoDB默认架构验证比较开始日期和结束日期

时间:2018-12-11 07:27:49

标签: node.js mongodb

1)开始日期和结束日期是字符串
2)比较是开始日期必须小于结束日期

验证器对象如下所示

"$jsonSchema" : {
    "bsonType" : "object", 
    "required" : [
        "taskname", 
        "startdate",
        "enddate"
    ], 
    "properties" : {
        "taskname" : {
            "bsonType" : "string"
        }, 
        "startdate" : {
            "bsonType" : "string"
        }, 
        "enddate" : {
            "bsonType" : "string"
        }
    }
}

0 个答案:

没有答案