This topic was automatically generated from Slack. You can find the original thread here.
how do i select, reference and manipulate data stores inside of NodeJS code steps
This topic was automatically generated from Slack. You can find the original thread here.
how do i select, reference and manipulate data stores inside of NodeJS code steps
To select, reference, and manipulate data stores inside of Node.js code steps in Pipedream, you can use the data store API provided by Pipedream. Here’s an example of how you might use it: export default defineComponent({ props: { data: { type: "data_store" }, }, async run({ steps, $ }) { // Get a value from the data store const value = await this.data.get("key"); // Set a new value in the data store await this.data.set("key", "new value"); // Check if a key exists in the data store const hasKey = await this.data.has("key"); // Delete a key from the data store await this.data.delete("key"); // List all keys in the data store const keys = await this.data.keys(); // Clear all keys in the data store await this.data.clear(); }, })
In this example, this.data
is used to interact with the data store. You can use the get
, set
, has
, delete
, keys
, and clear
methods to manipulate the data store within your Node.js code steps. For more details and examples, please refer to the Pipedream documentation on using data stores in Node.js code steps.