import com.fourspaces.couchdb.Session;
import com.fourspaces.couchdb.Database;
import com.fourspaces.couchdb.Document;
import com.fourspaces.couchdb.View;
import com.fourspaces.couchdb.ViewResults;
import com.fourspaces.couchdb.CouchResponse;
import com.fourspaces.couchdb.AdHocView;
public class temporaryViews
{
public static void main(String[] args) throws Exception
{
Session s = new Session("localhost",5984,"monil","monil",false,false);
Database db = s.getDatabase("foodb");
// Running a view
ViewResults resultAdHoc = db.adhoc("function (doc) {emit(null, doc);}");
System.out.println(resultAdHoc.getResults().size());
}
}
我試着用上面的代碼來創建臨時視圖中使用CouchDb4J API不工作,我得到臨時視圖是Java
Exception in thread "main" java.lang.NullPointerException
at temporaryViews.main(temporaryViews.java:53)
請建議的解決方案
在此先感謝
我需要使用Couchdb4j api創建視圖,任何人都可以向我建議解決方案 – monil