CouchDB
1.curl命令
RESTful
- 新增:POST请求
- 修改:PUT请求
- 删除:DELETE请求
- 查找:GET请求
查看数据库有哪些
curl -X GET http://admin:123456@localhost:5984/_all_dbs
admin: 用户名
123456:改成自己密码
创建数据库
curl -X PUT http://admin:123456@localhost:5948/name
删除数据库
curl -X DELETE http://admin:123456@localhost:5948/name
### 2.图形化页面Fauxton
How to pronounce fauxton
可以使用以下网址与CouchDB Web界面进行交互:
http://127.0.0.1:5984/_utils
数据
{"_id": "unique-document-id-1","item": "basketball","prices": { "京东": 55.00,"拼夕夕": 48.00,"淘宝": 50.00}
}{"_id": "unique-document-id-2","item": "volleyball","prices": {"京西": 40.00,"淘宝": 45.00,"并多多": 38.00}
}{"_id": "unique-document-id-3","item": "baseball","prices": {"淘宝": 25.00,"京东": 30.00,"拼多多": 22.00}
}
{"_id": "unique-document-id-4","item": "table","prices": {"淘宝": 200.00,"拼多多": 198.00}
}
{"_id": "unique-document-id-5","item": "apple","prices": {"唯品会": 5.00,"淘宝": 6.00,"小红书": 4.50}
}
点击Create Document建立文档
Map函数
- doc
- emit()
目的: 建立View,查看淘宝中各个商品的价格
点击New View
function (doc) {if (doc.item && doc.prices) for (var shop in doc.prices){if (shop === "淘宝") {var key = doc.itemvar price = doc.prices[shop]emit(key, price)}}
}
完结撒花!