Get a document with a specific field value in CouchDB?

You can create a view that has email as a key and query that view for the specific email address. Which values are appropriate for the view depends on what you're going to do with the results. You may, for example, choose the number of documents containing an email address as the values of the view.

Up vote 2 down vote favorite share g+ share fb share tw.

I want to check if a document with a specific email exists. How can I do that? Couchdb link|improve this question asked Feb 7 '11 at 0:25ajsie5,695436109 97% accept rate.

You can create a view that has email as a key and query that view for the specific email address. Which values are appropriate for the view depends on what you're going to do with the results. You may, for example, choose the number of documents containing an email address as the values of the view.

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

Here's an idea for a map-function in your view (_design/foo): function (doc) { if (doc. Email) { emit(doc. Email, null); } }.

No, this will simply give a list of all docs that have any email -- not what was asked -- you would need to emit(doc. Email,doc. _id), then query the view with "?

Key=email" – Nick Perkins Mar 29 '11 at 18:25 corrected my code – Till May 8 '11 at 20:09.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions