将属性添加到MongoDb中的验证器时,如何设置默认值?

时间:2018-12-12 12:23:05

标签: node.js mongodb mongodb-query

示例:

validator: {
        $jsonSchema: {
          bsonType: 'object',
          required: ['name', 'lname'],
          properties: this.properties
               name: { bsonType: 'string' },
               lname: { bsonType: 'string' },
               enable: { bsonType: 'bool' },
               datecreation: { bsonType: 'date' }
        }
      }
    the }

为属性“ enable” itMongoDBible设置默认值,我的范围是 MongoDb Js(没有猫鼬)。

0 个答案:

没有答案
相关问题