合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
## 1.安装mongoDB[软件下载](https://pan.baidu.com/s/1Po-smFyD0EH4ofKOjyEZQg#list/path=%2F%E8%BD%AF%E4%BB%B6%E5%8C%85%2F%E6%95%B0%E6%8D%AE%E5%BA%93) ## 2.C:data/db ~~~ //在c盘下新建data/db路径,之后启动数据库服务 mongod ~~~ ## 3.使用node.js连接mongoDB ~~~ const MongoClient = require('mongodb').MongoClient; var url = 'mongodb://localhost:27017/'; MongoClient.connect(url, { useNewUrlParser: true },(err,client)=>{ if(err) throw err; console..log(‘数据库连接成功’); client.close(); }) ~~~ | SQL术语/概念 | MongoDB术语/概念 | 解释/说明 | | --- | --- | --- | | database | database | 数据库 | | table | collection | 数据库表/集合 | | row | document | 数据记录行/文档 | | column | field | 数据字段/域 | | index | index | 索引 | | table joins | | 表连接,MongoDB不支持 | | primary key | primary key | 主键,MongoDB自动将\_id字段设置为主键 |