Answers for "define maxmum size of schema field in nodejs"

0

define maxmum size of schema field in nodejs

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"
            }
         }
      }
   }
});
Posted by: Guest on May-31-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language