I want to query a CouchDB server (in this case Couchbase Sync Gateway) in order to count the number of documents matching a given key.
My view is below
{
"views": {
"wordlist_count": {
"map": "function(doc) {
if (doc.wordlist)
emit(doc.wordlist, null) }",
"reduce" : "_count"
}
}
}
Calling it with 'reduce=false' gives me all the keyed documents as expected, however without this I get {"total_rows":0,"rows":[],"Collator":{}}#
I've looked at lots of examples, not sure what could be going wrong.