Friday, July 27, 2018

Mongo DB for Sitecore

This is the head of your page. Example HTML page

MongoDB 

MongoDB is an open-source document database, and leading NoSQL database. MongoDB is written in c++. MongoDB is a highly scalable and performance oriented database. 

Database 

Database is a physical container for collections. Each database gets its own set of files on the file system. A single MongoDB server typically has multiple databases. 

Collection 
Collection is a group of MongoDB documents. It is the equivalent of an RDBMS table. A collection exists within a single database. Collections do not enforce a schema. Documents within a collection can have different fields. Typically, all documents in a collection are of similar or related purpose. 

Document 
A document is a set of key-value pairs. Documents have dynamic schema. Dynamic schema means that documents in the same collection do not need to have the same set of fields or structure, and common fields in a collection's documents may hold different types of data. 
Below given table shows the relationship of RDBMS terminology with MongoDB 

RDBMS 
MongoDB 
Database 
Database 
Table 
Collection 
Tuple/Row 
Document 
Column 
Field 
Table Join 
Embedded Documents 
Primary Key 
Primary Key (Default key _id provided by mongodb itself) 


Advantages of MongoDB over RDBMS 
·      Schema less: MongoDB is document database in which one collection holds different documents. Number of fields, content and size of the document can be differing from one document to another. 
·      No complex joins 
·      Deep query-ability. MongoDB supports dynamic queries on documents using a document-based query language that's nearly as powerful as SQL 
·      Tuning 
·      Ease of scale-out: MongoDB is easy to scale 
·      Conversion / mapping of application objects to database objects not needed 
·      Uses internal memory for storing the (windowed) working set, enabling faster access of data 
Why should use MongoDB 
·        Document Oriented Storage : Data is stored in the form of JSON style documents 
·      Index on any attribute 
·      Replication & High Availability 
·      Auto-Sharding 
·      Rich Queries 
·      Fast In-Place Updates 
·      Professional Support By MongoDB 
Where should use MongoDB? 
·      Big Data 
·      Content Management and Delivery 
·      Mobile and Social Infrastructure 
·      User Data Management 
·      Data Hub 

Installing MongoDB for sitecore

1.   Go to http://www.mongodb.org/downloads and download the 64 bit .zip file. Unzip the files in a directory on your computer.

2.   Setup Connection string in your project
<?xml version="1.0" encoding="utf-8"?>
<connectionStrings>
  <!--
    Sitecore connection strings.
    All database connections for Sitecore are configured here.
  -->
  ...
  ...
  ...
  <add name="analytics" connectionString="mongodb://localhost/analytics" />
  <add name="tracking.live" connectionString="mongodb://localhost/tracking_live" />
  <add name="tracking.history" connectionString="mongodb://localhost/tracking_history" />
  ...
</connectionStrings>
Sitecore 7.5 (and Sitecore 8.x) connectionstrings.config are already set up correctly.
3.   run 'mongod.exe', check “C:\Program Files\MongoDB\Server\3.2\bin”
  1. Create a data folder:
    1. C:\data\db
  2. In admin command prompt, navigate to the MongoDB bin folder
    1. c
    2. cd C:\Program Files\MongoDB\Server\3.2\bin
  3. Run the following command
    1. mongod --dbpath="C:\data\db"
    2. --logpath="C:\data\db\log.txt" --install
  4. Start –> run –> type in services.msc
  5. Look for “MongoDB”, click start

1 comment: