mirror of
https://github.com/n8n-io/n8n-docs.git
synced 2025-11-20 17:48:34 +00:00
add page on data mocking
This commit is contained in:
parent
861e24e262
commit
b8aae9178f
8
_snippets/data/data-mapping/how-to-pin-data.md
Normal file
8
_snippets/data/data-mapping/how-to-pin-data.md
Normal file
@ -0,0 +1,8 @@
|
||||
To pin data in a node:
|
||||
|
||||
1. Run the node to load data.
|
||||
2. In the **OUTPUT** view, select **Pin data** <span class="inline-image">{.off-glb}</span>. When data pinning is active, the button changes to show this <span class="inline-image">{.off-glb}</span>.
|
||||
|
||||
/// note | Nodes that output binary data
|
||||
You can't pin data if the output data includes binary data.
|
||||
///
|
||||
37
docs/data/data-mocking.md
Normal file
37
docs/data/data-mocking.md
Normal file
@ -0,0 +1,37 @@
|
||||
---
|
||||
title: Data mocking
|
||||
description: Ways to mock data in your n8n workflow.
|
||||
contentType: howto
|
||||
---
|
||||
|
||||
# Data mocking
|
||||
|
||||
Data mocking is simulating or faking data. It's useful when developing a workflow. By mocking data, you can:
|
||||
|
||||
- Avoid making repeated calls to your data source. This saves time and costs.
|
||||
- Work with a small, predictable dataset during initial development.
|
||||
- Avoid the risk of overwriting live data: in the early stages of building your workflow, you don't need to connect your real data source.
|
||||
|
||||
|
||||
## Mocking with real data using data pinning
|
||||
|
||||
Using [data pinning](/data/data-pinning/), you load real data into your workflow, then pin it in the output panel of a node. Using this approach you have realistic data, with only one call to your data source. You can [edit pinned data](/data/data-editing/).
|
||||
|
||||
Use this approach when you need to configure your workflow to handle the exact data structure and parameters provided by your data source.
|
||||
|
||||
--8<-- "_snippets/data/how-to-pin-data.md"
|
||||
|
||||
|
||||
## Mock data using the Code or Edit Fields nodes
|
||||
|
||||
You can create a custom dataset in your workflow using either the [Code node](/integrations/builtin/core-nodes/n8n-nodes-base.code/) or the [Edit Fields (Set) node](/integrations/builtin/core-nodes/n8n-nodes-base.set/).
|
||||
|
||||
In the Code node, you can create any data set you want, and return it as the node output. In the Edit Fields node, select **Add fields** to add your custom data.
|
||||
|
||||
The Edit Fields node is a good choice for small tests. To create more complex datasets, use the Code node.
|
||||
|
||||
## Output a sample data set from the Customer Datastore node
|
||||
|
||||
The Customer Datastore node provides a fake dataset to work with. Add and execute the node to explore the data.
|
||||
|
||||
Use this approach if you need some test data when exploring n8n, and you don't have a real use-case to work with.
|
||||
@ -19,14 +19,7 @@ Data pinning isn't available for production workflow executions. It's a feature
|
||||
|
||||
## Pin data
|
||||
|
||||
To pin data in a node:
|
||||
|
||||
1. Run the node to load data.
|
||||
2. In the **OUTPUT** view, select **Pin data** <span class="inline-image">{.off-glb}</span>. When data pinning is active, the button changes to show this <span class="inline-image">{.off-glb}</span>.
|
||||
|
||||
/// note | Nodes that output binary data
|
||||
You can't pin data if the output data includes binary data.
|
||||
///
|
||||
--8<-- "_snippets/data/how-to-pin-data.md"
|
||||
|
||||
## Unpin data
|
||||
|
||||
|
||||
@ -287,6 +287,7 @@ nav:
|
||||
- Data pinning: data/data-pinning.md
|
||||
- Data editing: data/data-editing.md
|
||||
- Data filtering: data/data-filtering.md
|
||||
- Data mocking: data/data-mocking.md
|
||||
- Binary data: data/binary-data.md
|
||||
- Manage n8n Cloud:
|
||||
- Overview: manage-cloud/overview.md
|
||||
|
||||
Loading…
Reference in New Issue
Block a user