新課程(mongodb數(shù)據(jù)庫,express框架)
mongodb
mongodb概述
mongodb是非關(guān)系型數(shù)據(jù)庫(C++開發(fā)的)
沒有表(行列),是集合(鍵值對bson)
mongodb增刪改查
增
db.user.innert(
{
"name":"liwei",
"tel":18843436650
}
);
db.user.innert(
{
"name":"liwei",
"tel":18843436650,
"yz":"100"
}
);
db.user.innertMany(
[
{
"name":"longdage",
"sex":1,
"jushu":"good"
},
{
"name":"gaoluofeng",
"zhiwu":"1ge",
"jushu":"yiliu"
}
]
);
刪
db.user.remove({"zhiwu":"1ge"});
改
db.user.update(
{
name:"longdage"
},
{
$set:{ // 這是一個$set修改器
sex:0000
}
}
);
db.user.update(
{
name:gaoluofeng
},
{
$set:{
xingqu:"jisuanji"
}
},
true, // 關(guān)注后面這兩個參數(shù)用途
true
);
查
db.user.find()[.toArray()|.prety()];
快捷啟動數(shù)據(jù)庫(通過bash)
#!/bin/bash
cd /home/liwei/mongodb/bin/
./mongodb --dbpath=../liwei_db
express框架
- 全局安裝
npm install -g express-generator
- 創(chuàng)建項(xiàng)目
express -e xiangmu 創(chuàng)建
views -試圖
routes -路由
app.js -入口支持
安裝外部依賴: npm install
修改首頁: vim view/index.ejs
修改路由: routes/index.js
啟動: npm start
作業(yè)
整理一個moogodb的學(xué)習(xí)手冊,交md文檔
安裝express, 了解路由(它不是mvc的架構(gòu)的,嘗試改)