masumsoft / express-cassandra

Cassandra ORM/ODM/OGM for NodeJS with support for Apache Cassandra, ScyllaDB, Datastax Enterprise, Elassandra & JanusGraph.
http://express-cassandra.readthedocs.io
GNU Lesser General Public License v3.0
227 stars 67 forks source link

Cannot delete instances where the primary key is a set #178

Open arik-gamerlink opened 5 years ago

arik-gamerlink commented 5 years ago

Hi, my table looks like the following

export default { fields: { ids: { type: 'frozen', typeDef: '<set<uuid>>', }, }, key: ['ids'],

When I fetch an instance using the ids set, and then attempt to delete it I get the following error

"ids cannot be restricted by more than one relation if it includes an Equal" "code": 8704, "query": "DELETE FROM \"PrivateChat\" WHERE \"ids\" = ? AND \"ids\" = ?;",

My guess is that CQL looks wrong

arik-gamerlink commented 5 years ago

If anyone is looking for a workaround using raw query

const query =DELETE FROM "keyspace"."Table" WHERE "ids"={${firstId},${secondId}};

and then you use the execute_query method https://express-cassandra.readthedocs.io/en/stable/notes/#raw-query