English 中文(简体)
在CouchDB中获取具有特定字段值的文档?
原标题:Get a document with a specific field value in CouchDB?
  • 时间:2011-02-07 00:25:59
  •  标签:
  • couchdb

我想检查是否存在带有特定电子邮件的文档。

我该怎么做?

最佳回答

您可以创建一个以电子邮件为关键字的视图,并在该视图中查询特定的电子邮件地址。哪些值适合视图取决于您将如何处理结果。例如,您可以选择包含电子邮件地址的文档数作为视图的值。

This is a short introduction to views: http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views

问题回答

CouchDB 2.0.0版本已经提供了一种简单的基于JSON的方法,可以在不使用MapReduce的情况下执行CouchDB查询。更多详细信息请参阅_find、_index和_explain API

以下是视图中map-函数的想法(_design/foo):

function (doc) {
    if (doc.email) {
        emit(doc.email, null);
    }
}




相关问题
couchdb for /really/ distributed replica

let s say i want to implement a distributed database (each node being the replica of the others); i hear that cdb is able to easily sync between two nodes and at least support some form of conflict ...

CouchDB View, Map, Index, and Sequence

I think read somewhere that when a View is requested the "map" is only run across documents that have been added since the last time it was requested? How is this determined? I thought I saw something ...

representing a many-to-many relationship in couchDB

Let s say I m writing a log analysis application. The main domain object would be a LogEntry. In addition. users of the application define a LogTopic which describes what log entries they are ...

couchDB , python and authentication

I have installed couchDB v 0.10.0, and am attempting to talk to it via python from Couch class downloaded from couchDB wiki. Problem is: Create database mydb : { error : unauthorized , reason : ...

Temp View Caching?

I m using CouchDB with a home-grown C# interface library. The most common method of accessing CouchDB with this library results in a temp view being created. I ve optimized the library so that it uses ...

热门标签