Home Database Mysql Tutorial MongoDB(一)简单介绍

MongoDB(一)简单介绍

Jun 07, 2016 pm 04:10 PM
mongodb one time introduce study Simple

这两天简单学习了一下MongoDB数据库,属于NoSQL类型数据库的一种,先简单宏观的看一下NoSQL的相关知识和MongoDB的基础知识。 NoSQL是Not Only SQL的缩写,它指的是非关系型数据库,即有别于Oracle,mysql,sqlserver等常用的关系型数据库。它是以key-value形式

这两天简单学习了一下MongoDB数据库,属于NoSQL类型数据库的一种,先简单宏观的看一下NoSQL的相关知识和MongoDB的基础知识。

NoSQL是Not Only SQL的缩写,它指的是非关系型数据库,即有别于Oracle,mysql,sqlserver等常用的关系型数据库。它是以key-value形式存在,即我们熟悉的JSON数据形式。

发展:NoSQL是随着互联网Web2.0网站的兴起,传统的关系数据库在应付web2.0网站,特别是超大规模数据量和高并发的SNS类型的web2.0纯动态网站已经显得力不从心,暴露了很多难以克服的问题,而NoSQL也就是为了应付这些问题而出现,并不断发展着。最开始是google公司的Bigtable,淘宝数据平台的Tair,视觉中国网站的MongoDB等都代表NoSQL的不断发展。

NoSQL发展迅速的原因:随着互联网的不断发展,各种类型的应用层出不穷,所以导致在这个云计算的时代,对技术提出了更多的需求。虽然关系型数据库已经在业界的数据存储方面占据不可动摇的地位,但是由于其天生的几个限制,使其难以满足以上的几个需求:扩展困难,读写慢,成本高,有限的支撑容量。但是NoSQL关注的对数据高并发读写和对海量数据的存储等,与关系型数据库相比,它们在架构和数据模型方面做了削弱,而在扩展和并发等方面做了增强突出。

特点:非关系型的,分布式的,开源的,水平可扩展的。

优点:扩展简单,读写更加快速,成本更加低廉,灵活的数据模型。

不足:不提供的对SQL的支持,支持的特性不够丰富,现在的产品相比关系型数据库不够成熟。

总而言之NoSQL的出现是紧随时代的步伐——大数据,云计算而诞生,并不断发展的,是处在一个成长中的。下边简单看一下它的比较成熟的一个产品MongoDB的简单介绍。

MongoDB 的名称取自“humongous” (巨大的) 的中间部分,足见mongodb 的宗旨在处理大量数据上面。是一个可扩展、高性能的下一代数据库,由 C++语言编写,旨在为web 应用提供可扩展的高性能数据存储解决方案。


Mongo DB很好的实现了面向对象的思想(OO思想),在Mongo DB中每一条记录都是一个Document对象。MongoDB最大的优势在于所有的数据持久操作都无需开发人员手动编写SQL语句,直接调用方法就可以轻松的实现CRUD操作。

好,看一下它有什么特性,根据这些特性我们可以选择什么时候用它:高性能、易部署、易使用,存储数据非常方便是它的主要特点:

2模式自由,支持动态查询、完全索引,可轻易查询文档中内嵌的对象及数组

2面向文档存储,易存储对象类型的数据, 包括文档内嵌对象及数组

2高效的数据存储,支持二进制数据及大型对象(如照片和视频)

2支持复制和故障恢复;提供了主-从、主-主模式的数据复制及服务器之间的数据复制

2自动分片以支持云级别的伸缩性,支持水平的数据库集群,可动态添加额外的服务器

适用场景:

2适合作为信息基础设施的持久化缓存层

2适合实时的插入,更新与查询,并具备应用程序实时数据存储所需的复制及高度伸缩性

2Mongo 的 BSON 数据格式非常适合文档化格式的存储及查询

2适合由数十或数百台服务器组成的数据库。因为 Mongo 已经包含了对 MapReduce 引擎的内置支持

不适用场景:

2要求高度事务性的系统

2传统的商业智能应用

2 复杂的跨文档(表)级联查询

综上,我们对NoSQL,MongoDB有了个宏观的理解,知道NoSQL出现并不断发展状态的原因,MongoDB的使用范围,长处短处等,这对于我们对此款软件的认识非常重要,关系到我们技术选择的一关。就是认识人一样,我们是从整体容貌开始,然后随着不断的深入,在观察他们细节外貌,行为方式,生活习惯等等,学习一门技术也是这样,先了解他了,然后在开始一点点的学习技术,并随着使用次数的增多,不断的加深理解,不断的升华。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1673
14
PHP Tutorial
1277
29
C# Tutorial
1257
24
Use Composer to solve the dilemma of recommendation systems: andres-montanez/recommendations-bundle Use Composer to solve the dilemma of recommendation systems: andres-montanez/recommendations-bundle Apr 18, 2025 am 11:48 AM

When developing an e-commerce website, I encountered a difficult problem: how to provide users with personalized product recommendations. Initially, I tried some simple recommendation algorithms, but the results were not ideal, and user satisfaction was also affected. In order to improve the accuracy and efficiency of the recommendation system, I decided to adopt a more professional solution. Finally, I installed andres-montanez/recommendations-bundle through Composer, which not only solved my problem, but also greatly improved the performance of the recommendation system. You can learn composer through the following address:

How to choose a database for GitLab on CentOS How to choose a database for GitLab on CentOS Apr 14, 2025 pm 04:48 PM

GitLab Database Deployment Guide on CentOS System Selecting the right database is a key step in successfully deploying GitLab. GitLab is compatible with a variety of databases, including MySQL, PostgreSQL, and MongoDB. This article will explain in detail how to select and configure these databases. Database selection recommendation MySQL: a widely used relational database management system (RDBMS), with stable performance and suitable for most GitLab deployment scenarios. PostgreSQL: Powerful open source RDBMS, supports complex queries and advanced features, suitable for handling large data sets. MongoDB: Popular NoSQL database, good at handling sea

Navicat's method to view MongoDB database password Navicat's method to view MongoDB database password Apr 08, 2025 pm 09:39 PM

It is impossible to view MongoDB password directly through Navicat because it is stored as hash values. How to retrieve lost passwords: 1. Reset passwords; 2. Check configuration files (may contain hash values); 3. Check codes (may hardcode passwords).

What is the CentOS MongoDB backup strategy? What is the CentOS MongoDB backup strategy? Apr 14, 2025 pm 04:51 PM

Detailed explanation of MongoDB efficient backup strategy under CentOS system This article will introduce in detail the various strategies for implementing MongoDB backup on CentOS system to ensure data security and business continuity. We will cover manual backups, timed backups, automated script backups, and backup methods in Docker container environments, and provide best practices for backup file management. Manual backup: Use the mongodump command to perform manual full backup, for example: mongodump-hlocalhost:27017-u username-p password-d database name-o/backup directory This command will export the data and metadata of the specified database to the specified backup directory.

MongoDB and relational database: a comprehensive comparison MongoDB and relational database: a comprehensive comparison Apr 08, 2025 pm 06:30 PM

MongoDB and relational database: In-depth comparison This article will explore in-depth the differences between NoSQL database MongoDB and traditional relational databases (such as MySQL and SQLServer). Relational databases use table structures of rows and columns to organize data, while MongoDB uses flexible document-oriented models to better suit the needs of modern applications. Mainly differentiates data structures: Relational databases use predefined schema tables to store data, and relationships between tables are established through primary keys and foreign keys; MongoDB uses JSON-like BSON documents to store them in a collection, and each document structure can be independently changed to achieve pattern-free design. Architectural design: Relational databases need to pre-defined fixed schema; MongoDB supports

How to set up users in mongodb How to set up users in mongodb Apr 12, 2025 am 08:51 AM

To set up a MongoDB user, follow these steps: 1. Connect to the server and create an administrator user. 2. Create a database to grant users access. 3. Use the createUser command to create a user and specify their role and database access rights. 4. Use the getUsers command to check the created user. 5. Optionally set other permissions or grant users permissions to a specific collection.

How to encrypt data in Debian MongoDB How to encrypt data in Debian MongoDB Apr 12, 2025 pm 08:03 PM

Encrypting MongoDB database on a Debian system requires following the following steps: Step 1: Install MongoDB First, make sure your Debian system has MongoDB installed. If not, please refer to the official MongoDB document for installation: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/Step 2: Generate the encryption key file Create a file containing the encryption key and set the correct permissions: ddif=/dev/urandomof=/etc/mongodb-keyfilebs=512

MongoDB vs. Oracle: Choosing the Right Database for Your Needs MongoDB vs. Oracle: Choosing the Right Database for Your Needs Apr 22, 2025 am 12:10 AM

MongoDB is suitable for unstructured data and high scalability requirements, while Oracle is suitable for scenarios that require strict data consistency. 1.MongoDB flexibly stores data in different structures, suitable for social media and the Internet of Things. 2. Oracle structured data model ensures data integrity and is suitable for financial transactions. 3.MongoDB scales horizontally through shards, and Oracle scales vertically through RAC. 4.MongoDB has low maintenance costs, while Oracle has high maintenance costs but is fully supported.

See all articles