CouchDB的真实示例 [英] CouchDB a real world example

查看:88
本文介绍了CouchDB的真实示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今晚,在我日常使用的Google Googling技术中,我看到了很多演讲,介绍了它的性能比任何RDBM好十到一百倍,如何将我们从SQL语言,表,主键等等中拯救出来。我决定自己尝试一下。唯一的问题,似乎我无法弄清楚它是如何工作的。

Tonight in my daily tech Googling I came across couchDB, after seeing tons of presentations about how it perform ten to hundred times better then any RDBM, how it would save us from SQL languages, tables, primary keys and so much more. I decided myself to try it myself. Only problem it seems I am unable to figure out how it works.

像开始一样,我想使用CouchDB编写Web联系人管理器。该项目将使用户能够执行诸如

Like for a start I would like to code a web contact manager using couchDB. The project would enable user to do basic stuff like


  • 创建/编辑/删除联系人

  • 的基本操作他们订购的联系人列表

  • 按照各种条件搜索他们

那么我该如何开始?

我的一些想法


  • 为每个用户创建数据库,例如July, Ann

  • 在这些数据库中,添加一些类型为contact的文档,该文档首先看起来像这样,请参见代码1

  • create / edit /删除是直接的,只需要在良好的数据库中进行PUT,POST,Delete操作即可。

  • 搜索将像dnolen建议的那样由beddb-lucene处理

  • create a database per user like July, Ann
  • in those DB, add some document with type contact, the document would look like this at first place see code 1
  • create / edit / delete is straight forward just need to do the PUT, POST, DELETE in the good database
  • searching would be handled by couchdb-lucene like dnolen suggested

现在这里出现了困难的部分,我不太了解整个map / reduce概念以及如何使用它来完成我以前使用SQL所做的工作。还有视图如何处理分页和分组。

now here come the difficult part, I don't really understand the whole map/reduce concept and how I can use that to do the jobs I used to do with SQL. Also with views how do you handle paging, also grouping.

我想用分页的链接构建一个类似这样的屏幕

I would like to build a screen with a paging set of links something like this


John, Doe
Johny, Hallyday
Jon, Skeet

A B C D E F **J** etc .... <-- those are link to see persons with that first name

如果可以提供示例,我应该创建什么视图来实现这一点。

what view should I create to achieve that, if you can provide samples it would wonderful.

联系文档。

{
    type: 'contact',
    firstname: 'firstname',
    lastname: 'lastname',
    email: ['home': 'foobar@foobar.net', 'work': 'foobar@foobar-working.net'],
    phone: ['home': '+81 00 0000 0000'],
    address: []
    ... some other fields maybe ...
}


推荐答案

即将出版的书由O'Reilly撰写,可以免费在线阅读:
http://books.couchdb.org/relax/

The upcoming book by O'Reilly is free to read online: http://books.couchdb.org/relax/

只需安装一个玩转-您可以在命令行上使用curl进行直接的http请求,也可以使用称为futon的内置Web界面。

Just install and play around - you can do straight http requests using curl on the command line, or use the built-in web interface called futon.

存储和检索数据非常容易,最困难的部分是根据映射/缩小视图而不是sql查询进行思考。

Storing and retrieving data is really easy, the hardest part is thinking in terms of map/reduce-views instead of sql queries.

这篇关于CouchDB的真实示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆