嘗試這樣的事情,這是一個有點更通用的,它允許訪問原始文件
using (var session = store.OpenSession())
{
//Issue a dummy query to make sure the indexing has finished
var dummyQuery = session.Query<dynamic>("Raven/DocumentsByEntityName")
.Customize(x => x.WaitForNonStaleResultsAsOfLastWrite())
.ToList();
//First get all the document types, i.e. the different entity names
var docTypes = store.DatabaseCommands.GetTerms("Raven/DocumentsByEntityName", "Tag", "", 128);
foreach (var type in docTypes)
{
Console.WriteLine("\n{0}:", type);
//Might need to do paging here, can only get at most 1024 docs in 1 go!
var docs = store.DatabaseCommands.StartsWith(type, 0, 1024).ToList();
foreach (var doc in docs)
{
Console.WriteLine(" {0}: {1}", doc.Key, doc.ToJson());
}
}
}
你想做什麼,你爲什麼要列出數據庫中的所有文檔? – 2012-04-25 13:25:27
如果您只想查看所有文檔,請啓動ravendb服務器並訪問http:// localhost:8080/docs或http:// localhost:8080/raven/documents.html – 2012-04-25 13:27:41
您好Matt,我正在構建GUI Ravendb和我的操作之一是檢索單個數據庫中的所有文檔。可能嗎 ? – 2012-04-26 05:45:55