# storage.query

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

`type: "storage.query"`

Reads a connected database or bucket. The same actions as run(), inside a chain.

Status: free · storage required · read only

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `storage` | string | required | The storage's identifier. |
| `action` | string |  | `find`, `count`, `aggregate`, `collections`, `list`, `object`, `overview`… |
| `sql` | string |  | For a relational storage, instead of `action`. |

One of `action` and `sql` is required. Everything else — `collection`, `filter`, `limit`, `prefix`, `key` — follows the action, exactly as in [run()](/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 {#output}

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

## It only reads {#readonly}

Writing is [storage.write](/sdk/workflows/steps/storage-write), a different type with its own guards. A chain given only this one cannot modify anything, whatever its templates say.

## overview when you are building {#overview}

Run it once with [runStep()](/sdk/ref/workflow/run-step) to see the collections, their fields and a real example — then write the query that follows with the shapes in front of you.

- [storage.write](/sdk/workflows/steps/storage-write): Changing it.
- [run()](/sdk/ref/connected-storage/run): The same actions.
- [Workflow steps](/sdk/workflows/steps): The 23 types.

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