Normalized Data Model
Normalized data modeling involves splitting data into separate collections and using references or IDs to establish relationships, similar to traditional relational databases. This approach is advantageous for many-to-many or one-to-many relationships, offering efficient updates and queries due to its structured and normalized data organization.
Syntax:
// Example of normalized data model
// Collection 1: Users
{
_id: ObjectId("123"),
name: "John Doe"
}
// Collection 2: Addresses
{
_id: ObjectId("456"),
userId: ObjectId("123"),
street: "123 Main St",
city: "New York",
country: "USA"
}
MongoDB Data Modeling for MERN Beginners
MongoDB is a document-oriented NoSQL database system that provides high scalability, flexibility, and performance. Unlike standard relational databases, MongoDB stores data in a JSON document structure form. This makes it easy to operate with dynamic and unstructured data and MongoDB is an open-source and cross-platform database System.