# storage.query

Canonical URL: https://developers.iagenify.com/zh/sdk/workflows/steps/storage-query/
Language: zh

`type: "storage.query"`

读取连接的数据库或桶。 与运行( ) 相同, 在链条内 。

Status: free · storage required · read only

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `storage` | string | 必填 | 仓库的识别资料 |
| `action` | string |  | `find`, `count`, `aggregate`, `collections`, `list`, `object`, `overview`… |
| `sql` | string |  | 而不是用于用于 `action`. |

其中一个 `action` 和 `sql` 其它一切—— `collection`, `filter`, `limit`, `prefix`, `key` - 紧跟行动,如 [运行()](/zh/sdk/ref/connected-storage/run).

```javascript
{ id: "read", type: "storage.query", config: {
    storage: "…", action: "find", collection: "posts",
    filter: { createdAt: { $gte: "{{input.since}}" } }, options: { limit: 50 } } }
```

## 输出 {#output}

```javascript
{{steps.read.output.result}}     // what the action returned
{{steps.read.output.storage}}    // the storage's label
{{steps.read.output.provider}}
```

## 其只读 {#readonly}

正在写入 [storage.write](/zh/sdk/workflows/steps/storage-write), 一种不同的类型, 有自己的警卫。 仅给这个链条的链条不能修改任何东西, 不管它的模板怎么说。

## 正在建设时的概览 {#overview}

一次一起运行 [运行Step()](/zh/sdk/ref/workflow/run-step) 查看收藏、它们的字段和真正的例子——然后用前面的形状写出随后的查询。

- [storage.write](/zh/sdk/workflows/steps/storage-write): 改变它。
- [run()](/zh/sdk/ref/connected-storage/run): 同样的动作。
- [工作流步骤](/zh/sdk/workflows/steps): 全部 23 种类型。

```python
{"id": "read", "type": "storage.query", "config": {
    "storage": "…", "action": "find", "collection": "posts",
    "filter": {"createdAt": {"$gte": "{{input.since}}"}}, "options": {"limit": 50}}}
```

```python
"{{steps.read.output.result}}"     # what the action returned
"{{steps.read.output.storage}}"    # the storage's label
"{{steps.read.output.provider}}"
```
