As you learned in earlier chapters, one of the advantages of MongoDB is its flexible schema, meaning that not all documents have to have the same shape. The term shape refers to the fields that are present. This means that you could add a document that has only some or even none of the fields present in another document.
However, this isn’t always ideal in production, and many people find that they want to enforce the document shape. This can include the fields, value limitations such as character length, and even data ...