1

Can I Define a Custom Partition Key for GridDB Containers Using Node.js?

I want to distribute data across GridDB nodes based on a custom column (e.g., region_id) instead of relying on automatic partitioning

Use Case: All records with region_id = "East" should reside on Node 1, and region_id = "West" on Node 2

`const containerInfo = {

name: "regional_data",   

columns: [{ name: "region_id", type: "STRING" }],   

};

store.putContainer(containerInfo, { partitionKey: "region_id" }); // this is hypothetical`

I have two Specific Questions

Does GridDB support custom partition keys via the Node.js API?

If not, what workarounds exist to control data distribution?

**Additional Context: **

The official Node.js client documentation does not mention partition key configuration.

1
  • The official GridDB Node.js client does not support setting a custom partition key like "region_id" — partitioning is handled automatically based on the container name hash. To control data distribution, your workaround would be to create separate containers per region, like regional_data_east, regional_data_west, and then route reads/writes manually in your app logic. Unfortunately, fine-grained partitioning by column isn't supported in the Node.js client at this time. Commented Sep 5 at 9:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.