MongoDB tutoria...login
MongoDB tutorial
author:php.cn  update time:2022-04-21 17:49:03

Introduction to MongoDB


What is MongoDB?

MongoDB is written in C++ language and is an open source database system based on distributed file storage.

In the case of high load, adding more nodes can ensure server performance.

MongoDB aims to provide scalable, high-performance data storage solutions for WEB applications.

MongoDB stores data as a document, and the data structure consists of key-value (key=>value) pairs. MongoDB documents are similar to JSON objects. Field values ​​can contain other documents, arrays, and document arrays.



Main features

  • MongoDB provides a document-oriented storage that is relatively simple and easy to operate.

  • You can set the index of any attribute in the MongoDB record (for example: FirstName="Sameer",Address="8 Gandhi Road") to achieve faster sorting.

  • You can create data mirrors locally or over the network, which makes MongoDB more scalable.

  • If the load increases (requires more storage space and stronger processing power), it can be distributed on other nodes in the computer network. This is called sharding.

  • Mongo supports rich query expressions. The query command uses tags in JSON format to easily query objects and arrays embedded in the document.

  • MongoDb uses the update() command to replace the completed document (data) or some specified data fields.

  • Map/reduce in Mongodb is mainly used for batch processing and aggregation of data.

  • Map and Reduce. The Map function calls emit(key, value) to traverse all the records in the collection, and passes the key and value to the Reduce function for processing.

  • Map function and Reduce function are written in Javascript and can perform MapReduce operations through db.runCommand or mapreduce command.

  • GridFS is a built-in feature in MongoDB that can be used to store a large number of small files.

  • MongoDB allows scripts to be executed on the server side. You can write a function in Javascript and execute it directly on the server side. You can also store the function definition on the server side and call it directly next time. Can.

  • MongoDB supports various programming languages: RUBY, PYTHON, JAVA, C++, PHP, C# and other languages.

  • MongoDB is easy to install.



history In October 2007, MongoDB was developed by the 10gen team. First launched in February 2009.
  • On May 23, 2012, the MongoDB2.1 development branch was released! This version adopts a new architecture and contains many enhancements.

  • On June 6, 2012, MongoDB 2.0.6 was released, a distributed document database.

  • On April 23, 2013, MongoDB 2.4.3 was released. This version includes some performance optimizations, feature enhancements and bug fixes.

  • On August 20, 2013, MongoDB 2.4.6 was released, which is the latest stable version.



MongoDB Download

You can download the installation package from the mongodb official website at: http://www.mongodb.org/downloads . MongoDB supports the following platforms:

  • OS X 32-bit

  • OS X 64-bit

  • Linux 32-bit

  • Linux 64-bit

  • Windows 32-bit

  • Windows 64-bit

  • Solaris i86pc

  • Solaris 64



MongoDB Tools

There are several management tools available for MongoDB.

Monitoring

MongoDB provides the network and system monitoring tool Munin, which is used in MongoDB as a plug-in.

Gangila is a high-performance system monitoring tool for MongoDB. It is used in MongoDB as a plug-in.

Cacti, an open source tool based on a graphical interface, is used to view CPU load and network bandwidth utilization. It also provides a plug-in for monitoring MongoDB.

GUI

  • Fang of Mongo – Web-based, composed of Django and jQuery.

  • Futon4Mongo – A mongodb copycat version of CouchDB Futon web.

  • Mongo3 – written in Ruby.

  • MongoHub – App for OSX.

  • Opricot – A browser-based MongoDB console written in PHP.

  • Database Master - Windows mongodb management tool

  • RockMongo - The best PHP language MongoDB management tool, lightweight, supports multiple countries Language.



MongoDB application cases

The following are some practical applications of MongoDB in companies:

  • Craiglist uses MongoDB to archive billions of records.

  • FourSquare, a location-based social networking site, uses MongoDB to share data on Amazon EC2 servers.

  • Shutterfly, an internet-based social and personal publishing service, uses MongoDB for a variety of persistent data storage requirements.

  • bit.ly, a web-based URL shortening service, uses MongoDB to store its data.

  • spike.com, an affiliate company of MTV Networks, spike.com uses MongoDB.

  • Intuit, a provider of software and services for small businesses and individuals, uses MongoDB for small businesses to track user data.

  • sourceforge.net, a resource website to find, create and publish open source software for free, using MongoDB backend storage.

  • etsy.com , a website for buying and selling handmade items, uses MongoDB.

  • The New York Times, one of the leading online news portals, uses MongoDB.

  • CERN, the famous particle physics institute, uses MongoDB for data from the Large Hadron Collider at the European Center for Nuclear Research.

php.cn