© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2024
L. CarterBeginning MongoDB Atlas with .NEThttps://doi.org/10.1007/978-1-4842-9550-2_10

10. Schema Validation

Luce Carter1  
(1)
Manchester, UK
 

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 ...

Get Beginning MongoDB Atlas with .NET: Flexible and Scalable Document Data Storage for .NET Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.