20160918學(xué)習(xí)筆記
數(shù)據(jù)庫排行榜
http://db-engines.com/en/ranking
下載并安裝mongodb
mongodb-linux-x86_64-ubuntu1604-3.2.8.tgz
tar zxvf mongodb-linux-x86_64-ubuntu1604-3.2.8.tgz
mv mongodb-linux-x86_64-ubuntu1604-3.2.8 mongodb
cd mongodb
第二種安裝方式
apt-get install mongodb
啟動并使用mongodb
mkdir my_db
./bin/mongod --dbpath=./my_db
cd bin
./mongo
show dbs;
db.users.insert({'name':'liwei'});
show collections;
db.users.find();
db.users.insert({'name':'yulong','age':18});
db.users.insertMany([
{'name':'xiaowang','age':16,'height':170},
{'username':'canglaoshi','xiongwei':'d'}
]);
db.users.find().toArray();
db.users.find().pretty();
db.users.update({'name':'yulong'},{$set:{'age':20}});
db.users.update({條件},{更新的內(nèi)容},{是否插入數(shù)據(jù)},{是否更新多條數(shù)據(jù)});
db.users.update({name:'liwei'},{$set:{weight:130}});
db.users.remove({name:"liwei"});
遇到的問題
- F CONTROL [main] Failed global initialization: BadValue: Invalid or no user locale set. Please ensure LANG and/or LC_* environment variables are set correctly.
解決辦法:
vim /etc/profile
export LC_ALL=C
或者直接在終端里輸入 export LC_ALL=C
作業(yè)
- 3個頁面(首頁陕靠,列表頁,詳情頁)
- 練習(xí)mongodb,整理一個完整的文檔(markdown)