运行 读读

化学

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

收藏中最近文档的字段, 及其类型。 足够写查询而不猜测 。

document databasefreesampled, not declared
Using Python?

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

文件数据库没有可阅读的图案,因此,它通过查看来构建一个图案:20个最新文件、每个文件的每个字段和所看到的类型。

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

读得当

信号信号含义
以 相等的样本方式在每个文件样本中都提供。
抽样调查在下层或新增加的可选。
在一个字段上的若干类型它不一致——处理或确定数据。
完全没有字段在最近二十年,它可能仍然存在于老的身上。
20份最近的文件是抽样文件,不是合同

一年前停止写入的字段将不会出现, 昨天添加的字段将占主导地位。 它告诉你如何查询今天的数据; 它并不描述里面的一切。

括号与大小

嵌套对象在深层两层,点形—— customer.email 最多150个田地会回来

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"}))