I want to check if a document with a specific address exists.
How can i do this?
You can create a view with email as a key and request that view for a specific email address. Which values ββare appropriate for the presentation depends on what you are going to do with the results. For example, you can select the number of documents containing an email address as view values.
This is a brief introduction to the views: http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views
Here's the idea for a map function in your view ( _design/foo ):
map
_design/foo
function (doc) { if (doc.email) { emit(doc.email, null); } }
CouchDB release 2.0.0 already provides a simple JSON method for executing CouchDB queries without MapReduce. More information can be found in the _ find, _index and _explain API