couchbaselabs / TouchDB-Android

CouchDB-compatible mobile database; Android version

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ektorp CouchDbRepository getAll() issue

cjami opened this issue · comments

Strangely, this only applies to one of our repositories in our application.

TDView allView = database.getViewNamed("SomeDocType/all");

allView.setMapReduceBlocks(new TDViewMapBlock() {
    @Override
    public void map(Map<String, Object> document, TDViewMapEmitBlock emitter) {
        String type = (String) document.get("type");
            if (type.equals("SomeDocType")) {
            emitter.emit(null, document.get("_id"));
        }
    }
}, null, "1.0");

Following calls to CouchDbRepository.getAll will return all documents in the database.

Current workaround is to override getAll and use queryView("all") instead of the super method.

There are 3 other repositories that act on the same database.