Managing Data on Instances
Serverless Cloud provides its own K/V data store called Serverless Data attached to every instance as a part of its runtime. It's possible to manipulate Serverless Data programmatically using data
interface of the Serverless Development Kit but sometimes developers need to view data, delete some items, or repair them to keep the integrity. Serverless Cloud provides Data tab on the Instance Detail page to meet this need.
Note that this feature is provided in beta and should be used accordingly.
Querying Serverless Data with Data Manager
Using Data Manager, you can view all the data of an instance or you can view specific items by querying by the key. Note that you can use the conditionals explained here to filter the data required. In the below image, you see that we are trying to see the items whose id is less than 3.
Besides the primary index, you can also run queries on labels to filter data. In the below example, we filter all the completed todo items with a query.
You can switch to JSON view to see the fields of items in a more developer-friendly way.
Note that the results are paginated and the page size is 100 by default. You can increase it to 1000 if you prefer.
Adding new items with Data Manager
There might be some cases where you need to run a quick test with an exact data. You can always populate data for tests on Serverless Cloud with beforeAll
function, but it's sometimes a tiny case that needs a quick turnaround. In such cases, you can add items using the Data Manager. In the below image, we are adding a new todo item by providing a key, value, and/or any additional metadata.
Deleting items with Data Manager
Developers may also need to delete some data to preserve the integrity of data, to test a specific case, or for any other reason. In such cases, the Data Manager lets you delete items from Serverless Data. Please note that this operation is irreversible and should be used accordingly.