Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Griddb node api #8

Open
victortosin02 opened this issue Aug 18, 2024 · 2 comments
Open

Griddb node api #8

victortosin02 opened this issue Aug 18, 2024 · 2 comments

Comments

@victortosin02
Copy link

I am currently working on a Griddb project using NodeJS and I keep encountering this error. Can someonegive an insight into what is going on and what could be done?

Error: GSException {
mCode: -1,
mMessage: 'Error with number 140000',
mLocation: '',
mStackSize: 5
}

// Insert data into GridDB
async function insertIntoGridDB(data) {
const factory = griddb.StoreFactory.getInstance();
const store = factory.getStore({
"notificationMember": "172.24.0.2:10001",
"clusterName": "myCluster",
"username": "admin",
"password": "admin"
});

const containerName = 'occupation_stats';
const containerInfo = new griddb.ContainerInfo({
    name: containerName,
    columnInfoList: [
        ["occupation", griddb.Type.STRING],
        ["minIncome", griddb.Type.LONG],
        ["maxIncome", griddb.Type.LONG],
        ["minFamilySize", griddb.Type.LONG],
        ["maxFamilySize", griddb.Type.LONG]
    ],
    type: griddb.ContainerType.COLLECTION,
    rowKey: true
});

const container = await store.putContainer(containerInfo);
await container.createIndex({
    'columnName': 'occupation',
    'indexType': griddb.IndexType.DEFAULT
});

const rows = [];
for (const [occupation, stats] of Object.entries(data)) {
    rows.push([
        occupation,
        stats.minIncome,
        stats.maxIncome,
        stats.minFamilySize,
        stats.maxFamilySize
    ]);
}

await container.multiPut(rows);

}

@knonomura
Copy link
Member

Thank you so much for your usage.

I have a question.
Have you succeeded in running sample code like sample1.js on sample folder ?

@victortosin02
Copy link
Author

Yes I have . Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants