ReactiveCouchbase / ReactiveCouchbase-core

Core library for ReactiveCouchbase
Apache License 2.0
64 stars 28 forks source link

Creating views to read only keys #61

Open akirillov opened 9 years ago

akirillov commented 9 years ago

Hi everyone, I've been looking around for a way to get only String documents keys from the bucket. Here my map() function:

function (doc, meta) {
 if (doc.isDraft == false) {
   emit(null);
 } 
}

and I try to read keys the next way:

val query = new Query()
      .setLimit(Int.MaxValue)
      .setSkip(0)
      .setInclusiveEnd(true)
      .setStale(Stale.FALSE)

      bucket.find[String](DesignDocName, ViewName)(query)

When I try to execute the query I get Json Validation failed : Invalid JSON content : {"obj":[]} Is there any way to get keys only without fetching whole documents? Any help appreciated.