If you are using the CQL BATCH command in your application like this:
BEGIN BATCH
INSERT INTO ... ;
UPDATE ... ;
DELETE ... FROM ... ;
APPLY BATCH;
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:
const query1 = 'UPDATE user_profiles SET email = ? WHERE key = ?';
const query2 = 'INSERT INTO user_track (key, text, date) VALUES (?, ?, ?)';
const queries = [
{ query: query1, params: [emailAddress, 'hendrix'] },
{ query: query2, params: ['hendrix', 'Changed email', new Date()] }
];
// Promise-based call
client.batch(queries, { prepare: true })
.then(function() {
// All queries have been executed successfully
})
.catch(function(err) {
// None of the changes have been applied
});
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 DELETE operations 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!