I am building an app using AstraDB with NodeJS. I love Cassandra and wanted to try it out for my application
Unfortunately, The Node Cassandra Driver seems not to perform well. Batch Operations are not working. delete operations are also not working. They work fine when I run them in AstraDB CQL console. Is there something I am not aware of?
If you are using the CQL
BATCHcommand in your application like this:then it wouldn't work since it is designed to be used with the cqlsh utility only.
In your app, you will need to use the
Client.batch()API of the Node.js driver to execute batch statements. It takes an array of statements to execute in one atomic operation. Here is a sample code from the Node.js driver docs:Since you're new to Cassandra, I should point out that CQL batches should not be used for bulk-loading data since they are not an optimisation in the same way that batches are in relational databases. Only use CQL batches when you need to achieve atomicity for multiple partitions.
For the second part of your question, it's impossible to know what problem you are running into with
DELETEoperations because you didn't provide any detail.A friendly reminder that you need to (a) provide a good summary of the problem that includes software/component versions, the full error message + full stack trace; (b) describe what you've tried to fix the problem, details of investigation you've done; and (c) minimal sample code that replicates the problem. If it helps, I wrote an article on Asking good questions published on the official Apache Cassandra website. Cheers!