Mongodb Schema Validation
Mongodb Schema Validation
Tech name
BONAFIDE CERTIFICATE
Certified that this project report “mongodb Schema Validation” are the
bonafide work of “Agnes Metilda.R, Akash.J,Akash.M ,” who carried out the
projects work under my supervision.
SIGNATURE SIGNATURE
Coimbatore Coimbatore
Introduction:
SQL databases store data in tabular format. This data is stored in a predefined data model which is
not very much flexible for today’s real-world highly growing applications. Modern applications are
more networked, social and interactive than ever. Applications are storing more and more data
and are accessing it at higher rates.
Relational Database Management System(RDBMS) is not the correct choice when it comes to
handling big data by the virtue of their design since they are not horizontally scalable . If the
database runs on a single server, then it will reach a scaling limit. NoSQL databases are more
scalable and provide superior performance. MongoDB is such a NoSQL database that scales by
adding more and more servers and increases productivity with its flexible document model.
Features of MongoDB:
Document Oriented: MongoDB stores the main subject in the minimal number of
documents and not by breaking it up into multiple relational structures like RDBMS. For
example, it stores all the information of a computer in a single document called Computer
and not in distinct relational structures like CPU, RAM, Hard disk, etc.
Indexing: Without indexing, a database would have to scan every document of a collection
to select those that match the query which would be inefficient. So, for efficient searching
Indexing is a must and MongoDB uses it to process huge volumes of data in very less time.
Scalability: MongoDB scales horizontally using sharding (partitioning data across various
servers). Data is partitioned into data chunks using the shard key, and these data chunks
are evenly distributed across shards that reside across many physical servers. Also, new
machines can be added to a running database.
Replication and High Availability: MongoDB increases the data availability with multiple
copies of data on different servers. By providing redundancy, it protects the database from
hardware failures. If one server goes down, the data can be retrieved easily from other
active servers which also had the data stored on them.
Aggregation: Aggregation operations process data records and return the computed
results. It is similar to the GROUPBY clause in SQL. A few aggregation expressions are
sum, avg, min, max, etc
MongoDB currently provides official driver support for all popular programming languages like
C, C++, Rust, C#, Java, Node.js, Perl, PHP, Python, Ruby, Scala, Go, and Erlang
Installing MongoDB :
No complex joins.
Tuning.
Schema Validation
db.createCollection("posts", {
validator: {
$jsonSchema: {
bsonType: "object",
properties: {
title: {
bsonType: "string",
},
body: {
bsonType: "string",
},
category: {
bsonType: "string",
},
likes: {
bsonType: "int",
},
tags: {
bsonType: ["string"],
},
date: {
bsonType: "date",
}
}
})