Apache CouchDB

来自开放百科 - 灰狐
2009年8月8日 (六) 11:30Allen (讨论 | 贡献)的版本

跳转到: 导航, 搜索

Apache CouchDB is a distributed, fault-tolerant and schema-free document-oriented database accessible via a RESTful HTTP/JSON API. Among other features, it provides robust, incremental replication with bi-directional conflict detection and resolution, and is queryable and indexable using a table-oriented view engine with JavaScript acting as the default view definition language.

Apache CouchDB Sketch

CouchDB is written in Erlang, but can be easily accessed from any environment that provides means to make HTTP requests. There are a multitude of third-party client libraries that make this even easier for a variety of programming languages and environments.

相似项目: MongoDB

目录

简介

CouchDB是一个文档数据库;它是一个支持复制的(Replecated)文档数据库,具有REST接口,也就是说可以在 HTTP上,用标准的GET、PUT、POST动词去访问。而且它用JavaScript作为查询语言去建立数据视图(View)。在SQL数据库里,你要定义各种表和表中的数据类型及大小,CouchDB不一样,它是没有Schema的。在CouchDB里,每个文档都是独立的对象,可以是任意的 JSON结构。这是技术上的表述。那么它的优点在哪里呢?它有利于构建很多协作型的应用,很多Web应用都是围绕着文档、上下文、任务、Bug报告,诸如此类的东西。这些就是CouchDB最擅长的方面。

CouchDB和Lotus Notes最接近, 其核心就是文档模型.

CouchDB创造者Damien Katz畅谈CouchDB

Install

Windows

先安装 Erlang, 再安装 CouchDB

启动 C:\erl5.7.2\bin\couch_start.bat

访问 http://localhost:5984/_utils/index.html

更多细节: http://wiki.apache.org/couchdb/Installing_on_Windows

Database

A CouchDB database is a flat collection of these documents.

CouchDB Document

A CouchDB document is simply a JSON object.

A CouchDB document is an object that consists of named fields. Field values may be strings, numbers, dates, or even ordered lists and associative maps. An example of a document would be a blog post:

"Subject": "I like Django"  
"Author": "Allen"  
"PostedDate": "5/23/2009"  
"Tags": ["Python", "Django", "Framework"]
"Body": "Django is a high-level Python Web framework that encourages rapid development and clean, I like Django."

CouchDB Views

Views are the primary tool used for querying and reporting on CouchDB documents. There are two different kinds of views: permanent and temporary views.

Views are defined with Javascript functions. Here is the very simplest function:

function(doc) {
  emit(null, doc);
}

Python

Links

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱