Introducing with MongoDB

301 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
301
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Introducing with MongoDB

  1. 1. Introducing with MongoDB  Mahbub Tito Sr. Software Engineer, DataSoft Systems BD Ltd.
  2. 2. What is MongoDB?  It is a NoSQL database  Data is stored in documents, not tables / relations (Schema free). It uses BSON (binary JSON) format  MongoDB is Implemented in C++ for best performance  Scalable with high-performance (scales horizontally)  Platforms 32/64 bit Windows, Linux, Mac OS-X, FreeBSD, Solaris  Language drivers for :- PHP, Ruby/Ruby-on-Rails, Java, C#, JavaScript, C / C++, Python, Perl and much more ! ..
  3. 3. Why ?  Cost - MongoDB is free  MongoDb is easily installable.  Super low latency access to your data − Very little CPU overhead  No Additional caching layer required  Auto Sharding − Automatic balancing for changes in load and data distributed − Easy addition of new machines − Scaling out to one thousand nodes − No single points of failure, Automatic fail-over  Built in Replication and Horizontal Scaling support
  4. 4. Some Users
  5. 5. Similarity with RDBMS
  6. 6. Continued...
  7. 7. Continued... SQL Statement Mongo Statement
  8. 8. Anatomy of document
  9. 9. MongoDB Installation 1. Add 10gen package to source.list sudo gedit /etc/apt/sources.list Add : deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen 2. sudo apt-get update 3. 10gen package required GPG key, import it : sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 4. sudo apt-get install mongodb-10gen ---- Done 5. Test : tito@tito:~$ mongo MongoDB shell version: 2.0.6 connecting to: test
  10. 10. PHP Driver Installation Check that the PEAR and PECL are working with the following commands: $ PECL version If not found, install it to following commands: sudo apt-get install php-pear Then, sudo pecl install mongo Add the following line to your php.ini file: sudo gedit /etc/php5/apache2/php.ini extension=mongo.so Then Restart Web Server /etc/init.d/apache2 restart ---- DONE
  11. 11. Using from Terminal  $ mongo  > show dbs – Get list of all databases  > use microfin – creating DB  > db.users.insert( { _id : "alex", name: { first:"Alex", last:"Benisson" }, karma : 1.0 } )  > db.users.insert( { name: { first:"Kamal", last:"Khan" }, address : '33,Dhaka' } )  > show collections – Get collections list  > db.users.find()
  12. 12. Understanding MongoDB
  13. 13. Understanding MongoDB
  14. 14. Understanding MongoDB
  15. 15. Reference 1. http://docs.mongodb.org/manual/contents/ 2. PHP and MongoDB Web Development Beginners Guide

×