Mongodb深入浅出系列(1): 介绍
发布日期:2021-06-30 20:22:18
浏览次数:2
分类:技术文章
本文共 3780 字,大约阅读时间需要 12 分钟。
简介
MongoDB的mongo来源于单词humongous(其大无比的),它是一个开源免费的跨平台的面向文档的数据库。作为NoSQL数据库的一个代表,MongoDB区别于传统的以表结构为中心的关系性数据库,MongoDB更青睐于类似JSON写法的可动态变化schema的文档结构(MongoDB中称这种结构为BSON),JSON文件本身无需类似DB的schema即可被理解,这种方式使得不少类型的应用开发使用mongodb后更加简单和快捷。
License
MongoDB现由MongoDB Inc.公司开发,基于GPL和Apache License的组合。
发展轨迹
- 2007年 一家叫做10gen的公司开始开发MongoDB作为其PAAS的组成部分。
- 2009年,10gen迁移到开源开发,同时提供商业支持和其他服务。
- 2013年,10gen正式更名为MongoDB Inc.
MongoDB的特点
区别于传统的关系型数据库,mongodb比较突出的特点比如:
- 无需定义schema,是schema free的数据库 - 面向集合存储,易存储对象类型的数据 - 支持动态查询 - 支持完全索引,包含内部对象 - 支持查询 - 支持复制和故障恢复 - 使用高效的二进制数据存储,包括大型对象(如视频等) - 自动处理碎片,以支持云计算层次的扩展性 - 支持RUBY,PYTHON,JAVA,C++,PHP,C#等多种语言 - 文件存储格式为BSON - 可通过网络访问概念Mapping
关系型数据库 | MongoDB |
---|---|
database | database |
table | collection |
row | JSON文档等 |
MongoDB的安装和使用
参照文档 |
---|
初试mongodb
连接到mongodb
[root@host31 ~]# docker pull mongoUsing default tag: latestlatest: Pulling from library/mongo5c68a10e9f3f: Pull complete0110f95fa9c8: Pull complete0cba4a42bc41: Pull completea6eafd7fba3f: Pull complete703d9d7e0e21: Pull complete6c18d5bc22c9: Pull completefd3fcba178e3: Pull completec8b9b5488049: Pull complete41f37d58ab4c: Pull completeDigest: sha256:beff97308c36f7af664a1d04eb6ed09be1d14c17427065b2ec4b0de90967bb3fStatus: Downloaded newer image for mongo:latest[root@host31 ~]#[root@host31 ~]# docker run -d --name=mongo mongob2426160fd48b9614636c3466b8d6804f00a0c1d26373e1b7a37991e648f3e3b[root@host31 ~]# docker exec -it mongo /bin/bashroot@b2426160fd48:/#
连接mongo
root@b2426160fd48:/# mongoMongoDB shell version: 3.2.9connecting to: testWelcome to the MongoDB shell.For interactive help, type "help".For more comprehensive documentation, see http://docs.mongodb.org/Questions? Try the support group http://groups.google.com/group/mongodb-userServer has startup warnings:2016-08-27T23:58:55.597+0000 I CONTROL [initandlisten]2016-08-27T23:58:55.597+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.2016-08-27T23:58:55.597+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'2016-08-27T23:58:55.597+0000 I CONTROL [initandlisten]2016-08-27T23:58:55.597+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.2016-08-27T23:58:55.597+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'2016-08-27T23:58:55.597+0000 I CONTROL [initandlisten]>
help命令
> help db.help() help on db methods db.mycoll.help() help on collection methods sh.help() sharding helpers rs.help() replica set helpers help admin administrative help help connect connecting to a db help help keys key shortcuts help misc misc things to know help mr mapreduce show dbs show database names show collections show collections in current database show users show users in current database show profile show most recent system.profile entries with time >= 1ms show logs show the accessible logger names show log [name] prints out the last segment of log in memory, 'global' is default useset current database db.foo.find() list objects in collection foo db.foo.find( { a : 1 } ) list objects in foo where a == 1 it result of the last line evaluated; use to further iterate DBQuery.shellBatchSize = x set default number of items to display on shell exit quit the mongo shell>
显示db列表
> show dbslocal 0.000GB>
转载地址:https://liumiaocn.blog.csdn.net/article/details/52343546 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年04月08日 06时31分38秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
AMM做市无常损失对冲分析系列(一)—— 损益及期权对冲模型构建
2019-04-30
JS中document对象和window对象有什么区别
2019-04-30
【python练习题】遍历1
2019-04-30
【matlab】显示图片且下方显示文字
2019-04-30
关于greater<int>以及类模板的一些理解
2019-04-30
对于时间复杂度的通俗理解
2019-04-30
如何输入多组数据并输出每组数据的和?
2019-04-30
基于CentOS 7的Linux常用命令行命令
2019-04-30
行阶梯型矩阵
2019-04-30
临界资源与临界区
2019-04-30
matlab中uint8,double,im2double和im2uint8的区别
2019-04-30
数字图像处理总复习
2019-04-30
图像去噪(包含修正的阿尔法均值滤波及通用滤波方法代码)
2019-04-30
SVM进行人脸检测
2019-04-30
C++学习笔记
2019-04-30
图像处理学习笔记
2019-04-30
Machine Learning Onramp on MATLAB 学习笔记
2019-04-30
Machine Learning with MATLAB 1.1 to 2.2
2019-04-30
Learning DSP with MATLAB
2019-04-30
用MATLAB实现m序列的生成(MATLAB 2021a适用)
2019-04-30