corse · scriver

GotaCollezione

storage.run({ action: "dropCollection", collection })

Tira una collezion e tutto il in ella. Ti dice quanti documenti va.

document databasefreenot reversible
Using Python?

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

await storage.run({ action: "dropCollection", collection: "temp_import" });
// { ok: true, dropped: "temp_import", documents: 48211 }
storage.run(action="dropCollection", collection="temp_import")
# {"ok": True, "dropped": "temp_import", "documents": 48211}
documenti è quanti tu hai destruit

Retorna dopo il fatto, non prima. Lee il conte prima se il numero t'ha cambiat d'opinione — que l'appel è gratuito.

const { count } = await storage.run({ action: "count", collection });
if (count > 0) throw new Error(`${collection} still holds ${count} documents`);

await storage.run({ action: "dropCollection", collection });
count = storage.run(action="count", collection=collection)["count"]
if count > 0:
    raise RuntimeError(f"{collection} still holds {count} documents")

storage.run(action="dropCollection", collection=collection)

Una collezion che non è là è negat

Plutôt que di rispondere «fat» per qualcosa che non ha mai existit — che nascondesse un erro di battitura in un nome, al momento esatto un erro di battitura importa.

const existing = await storage.run({ action: "collections" });
if (!existing.some((c) => c.name === collection)) {
  // Nothing to drop. A misspelling here would otherwise look like success.
}
existing = storage.run(action="collections")
if not any(c["name"] == collection for c in existing):
    pass  # Nothing to drop. A misspelling here would otherwise look like success.

Funciona anche quando il stoccaggio è pieno

Como delete, la caduca è permisa oltre la quota: è come si fa spazio, quindi negaria che lascerebbe un storage che non puè svuotare.

Ce può fare un agent con essa

Il modo più aperto è il solo che lascia che questo non asked

In modo di pianificazione è respinto inequo. In ogni altra parte si chiede. Se un agente di suo non deve mai scapar ningun, dicilo in ses instruzions e responde la prompt - il modo da sola è un instrumente contundent.