MongoDB
เปรียบเทียบ mysql ⇨ mongo
table ⇨ collection
row ⇨ document
column ⇨ field
Install on Windows8.1
download from MongoDB
เลือก window server 2008 R2 64-bit and later with SSL
โหลดเสร็จ กดติดตั้งตามปกติ
configuration
default path "C:\Program Files\MongoDB\Server\3.4"
เพิ่มไฟล์ mongd.cfg ระบุ path ที่จัดเก็บ DB , log
systemLog:destination: filepath: d:\mongoDB\data\log\mongod.logstorage:dbPath: d:\mongoDB\data\db
Start mongod
เปิด command prompt (Winkey+R พิมพ์ cmd แล้วกด ctrl+shift+enter)cd C:\Program Files\MongoDB\Server\3.4\bin
mongod --config "C:\Program Files\MongoDB\Server\3.4\mongd.cfg"
Test mongo
เปิด command prompt (Winkey+R พิมพ์ cmd แล้วกด ctrl+shift+enter)
cd C:\Program Files\MongoDB\Server\3.4\bin
mongo
จะเข้าสู่ mongo shell
Mongo Command
insert db.collectionName.save()example : db.test.save({name:'screen',last:'lap'})
db.test.save([{name:'screen'},{name:'danai'}])
query db.collectionName.find()
example : db.test.find()
db.test.find({name:'screen'})
db.test.find().pretty()
update db.collectionName.update()
example : db.test.update({name:'screen'},{$set:{age:30}})
delete db.collectionName.remove()
example : db.test.remove({name:'screen'})
db.test.remove({name:'screen'},{justonce:true})
mongodb GUI download robomongo