bing
Flat 10% & upto 50% off + Free additional Courses. Hurry up!
×
UPTO
50%
OFF!

Data Models

MongoDB stores data in the form of BSON -Binary encoded JSON documents which supports a huge rich collection of types. Namely Fields in BSON documents may hold arrays of values or embedded documents as requirement. In MongoDB the data base construct in such a way as a group of related collections. Each database has a distinct and informative set of data files and can contain a large number of collections. A single MongoDB deployment consists of many databases.

What is a ‘document’ in MongoDB?

A record in MongoDB is a document which is been described below and a data structure composed of field and value pairs. MongoDB documents are very similar to JSON objects. The values of fields may consist of other such as documents, arrays, and arrays of documents. This is an important differentiation and vital feature devised from RDBMS systems where each field must contain only one value.

data models

Data stored in MongoDB has a flexible schema. Documents are fetched in the same collection. They don’t require same set of fields or structure, common fields in a collection’s documents which consist of different types of data.

Some  considerations while designing Schema in MongoDB

  • Design your schema according to user requirements.
  • Combine objects into single document if it is required to use together. Otherwise separate them without using joins.
  • Duplicate the data but only limited stuffs because disk space is cheaper compared to compute time.
  • Usage of joins implemented while write operation, not used on read.
  • Optimize your schema for most frequent use cases.
  • Complex aggregation is encouraged in the schema.

Consider the example

A client needs a database design for his blog or website creation and then notice the differences between RDBMS and MongoDB schema design.

  • Every post has the unique title, description and URL as per the requirement.
  • Every post can have more than one tags.
  • Every post has the name of its publisher and total number of likes given per post.
  • Every post has respective comments given by users along with their name, message, data-time and likes given for post.
  • On each post, there can be zero or any more comments.
  • In RDBMS schema, design for above requirements will be consisting of minimum three tables.

data models

"0 Responses on Data Models"

Leave a Message

100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.
top

Sales Offer

  • To avail this offer, enroll before 23rd February 2017.
  • This offer cannot be combined with any other offer.
  • This offer is valid on selected courses only.
  • Please use coupon codes mentioned below to avail the offer
offer-june

Sign Up or Login to view the Free Data Models.