我想在CouchBase Lite上使用map-reduce。我有文件,他们正在频道。我想要的所有功能都来自Couchbase Lite。但是,当我试图运行它们的map-reduce我收到以下错误在CouchBase Lite中运行map reduce时出错
com.couchbase.lite.CouchbaseLiteException: Error when calling map block of view 'calendar', Status: 593 (HTTP 500 Application callback block failed)
下面是我的地图缩小功能
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; }
和下面是主要的一部分,我我打电话视图和查询了它
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()); }
这意味着你的地图函数中抛出了一个异常。也许有一个无效的演员正在进行?我知道这是Java(对吧?),但根据我对C#的经验,如果实际值是int,ulong等,则不能直接从对象强制转换为long。 – borrrden