run · let

Schema

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

I campi vissuti in documenti recenti di una collezion, con i loro tipi. Suficiente per scriver una interrogazione senza addichire.

document databasefreesampled, not declared
Using Python?

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

Una base di documenti non ha schema da lere, quindi questo costruisce uno da guarding: i vinte documenti più recents, ogni campo che porta, e i tipi che vide.

await storage.run({ action: "schema", collection: "orders" });

// {
//   sampled: 20,
//   fields: [
//     { field: "_id",            types: ["objectId"], seenIn: 20 },
//     { field: "amount",         types: ["number"],   seenIn: 20 },
//     { field: "customer",       types: ["object"],   seenIn: 20 },
//     { field: "customer.email", types: ["string"],   seenIn: 19 },
//     { field: "refundedAt",     types: ["date", "null"], seenIn: 4 }
//   ]
// }
storage.run(action="schema", collection="orders")

# {
#   "sampled": 20,
#   "fields": [
#     {"field": "_id",            "types": ["objectId"], "seenIn": 20},
#     {"field": "amount",         "types": ["number"],   "seenIn": 20},
#     {"field": "customer",       "types": ["object"],   "seenIn": 20},
#     {"field": "customer.email", "types": ["string"],   "seenIn": 19},
#     {"field": "refundedAt",     "types": ["date", "null"], "seenIn": 4}
#   ]
# }

Lectura proa

SegnalSignificado
vistoIn iguals amostraPresent on every document sampled.
vistoBeno abaixo del campeonatoOpcional, o appena aggiunto.
Diversi tipus su un campoNon è coerente — maneja ambed, o fix i dadi.
Un campo non assente completeNon nei vents recents. Potrebbe ancora existere in anzian.
Venti documenti recenti è un esempio, non un contrat

Un campo che ha cessat di essere scrit un an fa non va aparecer, e un aggiunto ieri va dominar. Ti dice come interrogare i dati di oggi; non describe tutto in là.

Nesting e dimensiòn

Os objetos nidificati sono caminhati a due livelli profonda, punted — customer.email — que è esattamente come filtrare su dies. A lo più 150 campos retorn.

await storage.run({ action: "find", collection: "orders",
  filter: JSON.stringify({ "customer.email": "a@example.com" }) });
import json

storage.run(action="find", collection="orders",
            filter=json.dumps({"customer.email": "a@example.com"}))