~~~
const MongoClient = require('mongodb').MongoClient;
var url = 'mongodb://localhost:27017/';
console.time('start')
MongoClient.connect(url, { useNewUrlParser: true },(err,client)=>{
if(err) throw err;
client.db('my-test').collection("user").insertOne({name:"chengchao"},(err,result)=>{
if(!err) console.log("增加成功")
client.close()
console.timeEnd("start")
});
})
~~~
- MongoDB
- 第一章开发环境配置
- 第二章 基础操作
- 2-1 create-collection
- 2-2 collection-insert
- 2-3 find
- 2-4 query
- 2-5 sort排序
- 2-6 delete
- 2-7 drop-collection
- 2-8 update
- 2-9 limit
- 2-10 join
- 2-10-1 返回json给前台
- 2-11 ObjectId
- 第三章 数据库封装
- 3-0 数据库封装思路
- 3-1 单例
- 3-2 增加数据的执行时间
- 3-1-1 查询耗时
- 3-1-2 数据连接示例
- 3-3 简单封装
- 3-4 二次封装
- 3-5 结合art-template使用
- 3-6 数据库封装终极
- Redis
- 第一章 开发环境配置