Hi guys,
I am trying to use map-reduce on CouchBase Lite. I have documents and they are being channelised. All doucments what I want are coming to Couchbase Lite. But When I Try to run map-reduce on them I am getting the following error
com.couchbase.lite.CouchbaseLiteException: Error when calling map block of view 'calendar', Status: 593 (HTTP 500 Application callback block failed)
Below is my map reduce function
private View createView(Database database){ View calendarView = database.getView("calendar"); calendarView.setMap(new Mapper() { @Override public void map(Map<String, Object> document, Emitter emitter) { emitter.emit((long) document.get("date"),(long) document.get("cost")); } },"2"); return calendarView; }
and Below is the part of main where I am calling the view and querying over it
View calendarView = createView(database); Query query = database.getView("calendar").createQuery(); query.setStartKey(1472467249448l); query.setEndKey(1472553649449l); QueryEnumerator result = null; try { result = query.run(); } catch (CouchbaseLiteException e) { e.printStackTrace(); } for (Iterator<QueryRow> it = result; it.hasNext(); ) { QueryRow row = it.next(); Log.d(TAG, row.getValue().toString()); }