# 化学

Canonical URL: https://developers.iagenify.com/zh/sdk/ref/connected-storage/run/schema/
Language: zh

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

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

Status: document database · free · sampled, not declared

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

```javascript
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 }
//   ]
// }
```

## 读得当 {#reading}

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

> **20份最近的文件是抽样文件,不是合同**
>
> 一年前停止写入的字段将不会出现, 昨天添加的字段将占主导地位。 它告诉你如何查询今天的数据; 它并不描述里面的一切。

## 括号与大小 {#nesting}

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

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

- [查找查找查找查找查找](/zh/sdk/ref/connected-storage/run/find): 证件, une fois Qu'on sait sisifi 需求者。
- [run()](/zh/sdk/ref/connected-storage/run): 行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动,行动

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

```python
import json

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