Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法从 Raven db 获取所有文档的列表作为 ID 数组或 ID 列表。文档类型未知,因此必须作为动态处理。
提前致谢。
一种方法是这样的:
var keys = store.DatabaseCommands.GetDocuments(0, 1024, metadataOnly: true) .Select(x => x.Key) .ToArray();
这将返回数据库中的前 1024 个文档键 (ID)。如果您想要更多,那么您将不得不在循环中执行此操作并更新起始索引和页面大小。
我不确定您为什么要这样做。在数据库中拥有数千或数百万个文档是很常见的。您可能想重新考虑为什么需要这个。这不是一件常见的事情。