& جاري

تحذف عبارة

storage.run({ action: "delete", collection, filter, many, all })

يزيل مستندات تطابق -- أو كائن من a كلّ مباراة افتراضيّة، الذي هو واحد قيمة معرفة هنا.

document database · object storagefreeall matches by default
Using Python?

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

المعاملات

collectionstringمطلوب*

- - قاعدة بيانات الوثائق.

filterJSON textمطلوب*

أي وثائق. all: true.

manyboolean

false يزيل a واحد مستند. إفتراضي: كل متطابق.

allboolean

إلى معاينة a فارغ.

keystringمطلوب*

- لا يجوز أن يكون هناك أي غرض آخر.

// Documents
await storage.run({ action: "delete", collection: "sessions",
  filter: JSON.stringify({ expiresAt: { $lt: new Date().toISOString() } }) });
// { ok: true, deletedCount: 142 }

// An object
await storage.run({ action: "delete", key: "invoices/2026/01/a.pdf" });
import json
from datetime import datetime, timezone

# Documents
storage.run(action="delete", collection="sessions",
            filter=json.dumps({"expiresAt": {"$lt": datetime.now(timezone.utc).isoformat()}}))
# {"ok": True, "deletedCount": 142}

# An object
storage.run(action="delete", key="invoices/2026/01/a.pdf")
هذا واحد إلى كل متطابق، على عكس تحديث

تحديث يمس واحد ما لم تقل الكثير: صحيح؛ حذف يزيل كل منهم إلا إذا قلت الكثير: خاطئ. الاثنتان مختلفتان، والفرق لا يمكن استرداده في اتجاه واحد.

يجري رفض % مُرر

// Refused: this would empty the collection
await storage.run({ action: "delete", collection: "logs", filter: JSON.stringify({}) });

// Accepted: you said so, explicitly
await storage.run({ action: "delete", collection: "logs",
  filter: JSON.stringify({}), all: true });
import json

# Refused: this would empty the collection
storage.run(action="delete", collection="logs", filter=json.dumps({}))

# Accepted: you said so, explicitly
storage.run(action="delete", collection="logs", filter=json.dumps({}), all=True)

ويمر الحارس قبل وصول أي شيء إلى قاعدة البيانات، وقبل أن يطلب الإذن من وكيل - بحيث يتوقف الشكل الخطير دون حاجة إلى حكم من أي شخص.

& عليك حذف

نفس المرشح، معدود أولاً، يخبرك ما هو على وشك الذهاب. إنه حر، وهو المعاينة الوحيدة التي تحصل عليها.

const { count } = await storage.run({ action: "count", collection, filter });
if (count > 1000) throw new Error(`that filter matches ${count} documents — check it`);

await storage.run({ action: "delete", collection, filter });
count = storage.run(action="count", collection=collection, filter=filter)["count"]
if count > 1000:
    raise ValueError(f"that filter matches {count} documents — check it")

storage.run(action="delete", collection=collection, filter=filter)

جاري الإزالة يعمل حتى عندما يكون التخزين ممتلئاً

فالكتابات تُرفض بعد الحصة ، والحذف لا ، وهكذا تصنع الغرفة ، مخزن لا يمكنك ان تفرغه لأنه كامل ، سيكون فخا .