0

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.

Adamski
  • 3,585
  • 5
  • 42
  • 78

1 Answers1

0

Solved: I needed specify "reduce=true" in the query!

Adamski
  • 3,585
  • 5
  • 42
  • 78