课程: Data Modeling in MongoDB

今天就学习课程吧!

今天就开通帐号,24,100 门业界名师课程任您挑!

JSON Schema

JSON Schema

- [Instructor] Working hard to create a sane and stable model in Schema is great. But MongoDB by default doesn't enforce any of it. Left unchecked, you can insert anything you want into any document in any collection. Let's look at JSON Schema which gives us a tool to define our models with a strongly typed set of validation rules and see how MongoDB enforces them. Let's go ahead and put some records into our database. Now these statements are totally legal. Mongo doesn't care what you insert. Remember, it's an expressive system with every document's purpose being to fulfill some application requirement. This is by design. It's so very Mongo, isn't it? But there's a lot of issues here as you can clearly see. Now, it's not all bad. Remember that in the early stages, especially we don't know what we don't know but there is an inflection point when it's time to start enforcing Schema, some things are going to be…

内容