与数据库而不是收集工作有关的两个行动之一——因此没有 collection 和 。另一个是 概览概览.
await storage.run({ action: "collections" });
// [{ name: "users", count: 1204 }, { name: "orders", count: 88311 }]storage.run(action="collections")
# [{"name": "users", "count": 1204}, {"name": "orders", "count": 88311}]计数是估计数
从元数据阅读,而不是通过文件走过
精确地计算一个大型收藏就是读取它。 对于一个您要采取行动的数字, 使用过滤器来计算; 对于“ 这个大小多少 ” , 估计是您想要的, 并且它是免费的 。
系统收藏被遗漏
内部收藏被过滤, 所以返回的东西就是您放在那里的东西。 您创建的无法看到这里的收藏是一个符号, 您连接到不同的数据库, 可以看到 URI 路径路径 连接().
const collections = await storage.run({ action: "collections" });
if (!collections.length) {
// Either it is empty, or the connection landed on the wrong database.
// The database is read from the path of the URI: …/mydb
}collections = storage.run(action="collections")
if not collections:
# Either it is empty, or the connection landed on the wrong database.
# The database is read from the path of the URI: …/mydb
pass