我想在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