& قراءة

جد جد

storage.run({ action: "find", collection, filter, options })

مستندات مطابقة للمرشح مع page, sequation and a اختيار من.

document databasefreefilter as JSON text
Using Python?

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

المعاملات

collectionstringمطلوب

-أيّ جمع جمع

filterJSON text

السؤال: يعني كل شيء، سواء كان مهولاً أو فارغاً، limit.

options.limitinteger

كم عدد الذين. 0 لا حدود، وهذا نادراً ما تريده

options.skipinteger

كم عدد الذين سيخطون خطوة فوق -- هذا زائد limit هو من يُدعى.

options.sortobject

{ field: 1 | -1 }.

options.projectionobject

في أي حقول ستعود، حقول أقل، إجابة أصغر

await storage.run({
  action: "find",
  collection: "orders",
  filter: JSON.stringify({ status: "paid", amount: { $gt: 100 } }),
  options: { limit: 20, skip: 0, sort: { createdAt: -1 },
             projection: { _id: 1, amount: 1, customer: 1 } },
});
// [{ _id: "…", amount: 240, customer: { … } }]
import json

storage.run(
    action="find",
    collection="orders",
    filter=json.dumps({"status": "paid", "amount": {"$gt": 100}}),
    options={"limit": 20, "skip": 0, "sort": {"createdAt": -1},
             "projection": {"_id": 1, "amount": 1, "customer": 1}},
)
# [{"_id": "…", "amount": 240, "customer": {…}}]
جاري JSON النص النص النص

ليس كجسم. كائن معشوق يفقد مفاتيحه من البداية بدولار في الطريق عبر بعض المُتّصلين، والإستفسار يتطابق مع أكثر مما قصدت، دون قول ذلك.

تم تحويل المُعرفات لك

An _id given as a string is turned into the identifier type the database expects, including inside $in, $nin and $ne. So you can pass back an id you printed, without converting it yourself.

filter: JSON.stringify({ _id: "66f0c1a2b3c4d5e6f7a8b9c0" })
filter: JSON.stringify({ _id: { $in: [idA, idB] } })
filter = json.dumps({"_id": "66f0c1a2b3c4d5e6f7a8b9c0"})
filter = json.dumps({"_id": {"$in": [id_a, id_b]}})

الن

async function* pages(storage, collection, filter, size = 100) {
  for (let skip = 0; ; skip += size) {
    const rows = await storage.run({ action: "find", collection, filter,
      options: { limit: size, skip, sort: { _id: 1 } } });
    if (!rows.length) return;
    yield rows;
    if (rows.length < size) return;
  }
}
def pages(storage, collection, filter, size=100):
    skip = 0
    while True:
        rows = storage.run(action="find", collection=collection, filter=filter,
                           options={"limit": size, "skip": skip, "sort": {"_id": 1}})
        if not rows:
            return
        yield rows
        if len(rows) < size:
            return
        skip += size

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - _id الـ آمن افتراضي الـ نداء a إستفسار إستفسار إستفسار إقتران إقتراح مُعرض مستند و آخر.

ما هو مرفوض

% $where, $function أو $accumulator هو مرفوض: يُديرون شفرة داخل قاعدة البيانات. الرفض يحدث قبل إرسال الإستفسار.