📜  在 nodejs 中定义模式字段的最大大小 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:23.131000             🧑  作者: Mango

代码示例1
db.createCollection("people", {
   validator: {
      $jsonSchema: {
         bsonType: "object",
         required: [ "name" ],
         properties: {
            name: {
               bsonType: ["string"],
               description: "must be a string"
            },
            friends: {
               bsonType: ["array"],
               items : { bsonType: ["string"] },
               minItems: 0,
               maxItems: 10,
               description: "must be a array of string and max is 10"
            }
         }
      }
   }
});