Design a collection schema before load the data

Hello, in the example in atlas about creating a collection, the video shows the field and the data, but when we need a propose a schema before get the data, how do it.


Title: String,
year: Int32

Without example value only the expected type. or this is not allowed for the flexibility of the schemas in mongo?

Hi julioaaron,

Interesting question! If you want your schema to be defined before inserting documents, then I believe that is the in-flexibility of a collection. However, while creating a collection, you can define validation for specific fields with their data types too. Here is the documentation link: