2
我目前正在android上使用couchbase製作數據庫程序。在我複製數據後,如何獲取文檔ID以便列出數據庫中的所有內容。複製數據庫後如何獲取文檔ID
我目前正在android上使用couchbase製作數據庫程序。在我複製數據後,如何獲取文檔ID以便列出數據庫中的所有內容。複製數據庫後如何獲取文檔ID
您需要使用Queries!
如果要檢索所有文檔(或其ID),可以使用All-documents query。
Query query = database.createAllDocumentsQuery();
QueryEnumerator result = query.run();
for (Iterator<QueryRow> it = result; it.hasNext();) {
QueryRow row = it.next();
Log.w("MYAPP", "document ID: %s", row.getDocumentId()); // or QueryRow also has a way to get its source document.
}
您可以根據自己的需要編寫自己的視圖,以後再查詢結果。
另請參閱here的數據庫中的文檔處理方法。事實上,我建議通過整個引導去。