run · let

collections

storage.run({ action: "collections" })

Ogni collezion in una base de dati documental, con quanti documenti cada uno detiene.

document databasefreeno collection needed
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

Una delle due azioni che lavorano sulla base di dati invece di una collezion — non c'è collection a passare. L'altra è overview.

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}]

La conta è una stima

Legga da metadat, non camminando i documenti

Una conta esa su una grande collezion significa lectèa. Per una cifra che si agisce, use con un filtro; per «aproximatamente quanta grande è questo», la estimazione è ciò che si desidera e è gratuita.

Collecciona di sistema sono oltrati

Colleczioni interne sono filtrate, quindi il che torna è quello che si pone là. Una colleczion create e non pot vee aquí è un segno che si è connextu a una base di dati differente — veda il percorso URI on connect().

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