MongDB是文档型数据库,由数据库(database/repository)、集合(collection)、文档对象(document)三个层次组成。
MongDB中集合对用关系型数据库的表,但是集合中没有列,行和关系的概念,这体现了模式自由的特点。
传统的数据库,例如 Mysql,一般的数据库(database)、表(table)、记录(record)三个层次概念组成。
SQL与MongoDB对比。
SQL MongoDB 说明
database database 数据库
table collection SQL为数据库表,MongoDB为集合
row document SQL为数据记录行,MongoDB为文档
column field SQL为字段,MongoDB为域
index index 索引
table joins 表连接,MongoDB不支持
primary key primary key 主键,MongoDB中自动设置_id为主键
MongoDB在mac电脑上的安装。
方法1 在终端使用brew命令进行安装
// 更新brew
brew update
// 安装
brew install mongodb
// 或
brew install mongodb -with --openssl
//或
brew install mongodb —devel
// 卸载
brew uninstall mongodb
1// 更新brew
brew update
// 安装
brew install mongodb
// 或
brew install mongodb -with --openssl
//或
brew install mongodb —devel
方法2 下载MongoDB文件设置