• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/16

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

16 Cards in this Set

  • Front
  • Back

Features

1.Document based Db


2.BSON


3.High Performance and Scalability(esp.horizontal Scaling via sharding)


4.DbServer->Databases->Collections->Documents


5.Stored in files.


6.No joins or Transactions.


7.Indexing





Database

1.Has its own set of files.


2.Equivalent to database in sql.



Collection

1.Equivalent to table in sql


2.Contains multiple documents.


3.Schemaless - documents do not need to have same keys(columns), datatype of key in one document need not be the same as in another document etc.

Document

1.JSON format


2.Stored as BSON- has more datatypes compared to json


3.Must not exceed 16MB.



_id

1.Primary Key.


2.Unique Identifier.


3.Required


4.Immutable - cannot be changed.


5.If user does not provide _d while inserting a document, an ObjectID will be automatically created and inserted as _id by mongo db.

ObjectId

1.12 bytes hexadecimal number


2.4 bytes for the current timestamp(representing the seconds since the Unix epoch), next 3 bytes for machine id, next 2 bytes for process id of MongoDB server and remaining 3 bytes are simple incremental VALUE.

No Joins

Embedding documents should help in most cases

No Transactions

Operations at document level are atomic.


Embedded documents help upto some extent.


If not iImplement Transaction Logic in Code

Horizontal Scaling

Distributing data across multiple servers

Vertical Scaling

Increasing the server configuration -processing power, RAM etc.

mongod.exe --dbpath "d:\set up\mongodb\data" --logpath "d:\set up\mongodb\log"

mongod server installation

mongo

1.mongodb client- mongo shell.


2.uses javascript.



db.help()


db.stats()

{


"db" : "test",


"collections" : 15,


"objects" : 730,


"avgObjSize" : 108.05479452054794,


"dataSize" : 78880,


"storageSize" : 282624,


"numExtents" : 17,


"indexes" : 14,


"indexSize" : 138992,


"fileSize" : 67108864,


"nsSizeMB" : 16,


"extentFreeList" : { "num" : 0, "totalSize" : 0 }, "dataFileVersion" : { "major" : 4, "minor" : 22 }, "ok" : 1


}

ObjectId.getTimestamp()

Returns the timestamp portion of the object as a Date.

x = ObjectId()

In this example, the value of x would be:ObjectId("507f1f77bcf86cd799439011")