1.下载安装
地址:http://couchdb.apache.org/#download,直接顺序安装后,点击couchdb.cmd启动couchdb
2. 进入浏览器控制台
浏览器输入:http://127.0.0.1:5984/_utils
注册管理员信息后即可进行相关操作。注意create Database时不要出现大写字母,会添加失败。
3.常规使用
可以使用谷歌Postman进行相关测试操作
1)查couchDB信息
GET请求,http://127.0.0.1:5984
返回json:
{
"couchdb": "Welcome",
"version": "2.1.1",
"features": [
"scheduler"
],
"vendor": {
"name": "The Apache Software Foundation"
}
}
2)查数据库信息
GET请求,http://127.0.0.1:5984/couchdb
返回json:
{
"db_name": "couchdb",
"update_seq": "3-g1AAAAFTeJzLYWBg4MhgTmEQTM4vTc5ISXLIyU9OzMnILy7JAUoxJTIkyf___z8rkRmPoiQFIJlkD1bHgE-dA0hdPGF1CSB19QTV5bEASYYGIAVUOp8YtQsgavcTo_YARO19YtQ-gKgFuTcLANfhbzE",
"sizes": {
"file": 1524940,
"external": 1478272,
"active": 1480241
},
"purge_seq": 0,
"other": {
"data_size": 1478272
},
"doc_del_count": 0,
"doc_count": 1,
"disk_size": 1524940,
"disk_format_version": 6,
"data_size": 1480241,
"compact_running": false,
"cluster": {
"q": 8,
"n": 1,
"w": 1,
"r": 1
},
"instance_start_time": "0"
}
3)查看所有数据库
GET请求,http://127.0.0.1:5984/_all_dbs
返回json:
[
"couchdb",
"cydb",
"laji",
"myco",
"mydb"
]
4) 查看数据库文档信息
GET请求,http://127.0.0.1:5984/database_name/document_Id
案列:http://127.0.0.1:5984/couchdb/b9a6c0287dc4c0bea0df205516000c21
返回json:
{
"_id": "b9a6c0287dc4c0bea0df205516000c21",
"_rev": "3-e45c01189a0d0c9e925f12c9a25612d3",
"_attachments": {
"1.epd": {
"content_type": "",
"revpos": 2,
"digest": "md5-8b7MWEJf/OL7N6g3Y9f/vA==",
"length": 1478268,
"stub": true
}
}
}
GET请求,http://127.0.0.1:5984/database_name/document_Id/attachment_name
案列:http://127.0.0.1:5984/couchdb/b9a6c0287dc4c0bea0df205516000c21/1.epd