Querying local CBLite via REST API returns all doc revisions (not just current rev)

I have a Cordova app on Android, it uses the Couchbase Lite Phonegap plugin 1.2.0 https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin

When I use the REST API to query a view from the local CBL instance, it returns not only the current revision of a document, but also all prior revisions.
Is that by-design ?

I could implement logic in the map/reduce functions to exclude old revisions, but I’d like to avoid that if possible.

My map function looks like this:
function (doc)
if (doc.DocType == “SettingRecord”)
emit(doc.TimeStamp === undefined ? 0 : doc.TimeStamp, doc)

The REST call looks like this: http://localhost:5984/btlelog1/_design/btlelog/_view/SettingRecord

It returns all prior revision for each _id:
{“doc”:null,“id”:“04d4aa85-d71c-4122-b06d-ba2baad01c4f”,“key”:1457654758047,“value”:{“DocName”:“ScanInterval”,“SettingValue”:5000, “DocType”:“SettingRecord”,“TimeStamp”:1457654758047,"_id":“04d4aa85-d71c-4122-b06d-ba2baad01c4f”,"_rev":“2-5feb92ddd1ab8cbf23a5d1656791a756”,"_local_seq":41}},

No, it’s not supposed to do that. And the “doc” and “id” properties for each row shouldn’t be there either, unless I’m misremembering. @hideki?

BTW, it’s usually a bad idea to emit “doc” as the value. It makes the view index a lot larger than it needs to be. Just emit the properties you need, or null if you don’t need any.

Thanks, Jens. I’ll wait for a fix.

The chances of it getting fixed are higher if you file a bug report :slight_smile:

Done. https://github.com/couchbase/couchbase-lite-java-core/issues/1098

When I changed storeType from SQLite to ForestDB,This issue is gone.