If your table has multiple columns in its primary key, you may use the full primary key definition syntax to express that:
primaryKey: { partitionBy: ['pt_key1', 'pt_key2'], partitionSort: { cl_key1: 1, cl_key2: -1 },} Copy
primaryKey: { partitionBy: ['pt_key1', 'pt_key2'], partitionSort: { cl_key1: 1, cl_key2: -1 },}
Note that, if you don't have any clustering keys (partition sorts), you can omit the partitionSort field entirely:
partitionSort
primaryKey: { partitionBy: ['pt_key1', 'pt_key2'],} Copy
primaryKey: { partitionBy: ['pt_key1', 'pt_key2'],}
A sort of 1 on the clustering column means ascending, and a sort of -1 means descending.
1
If your table definition only has a single partition key, and no clustering keys (partition sorts), you can use the shorthand syntax instead:
primaryKey: 'pt_key', Copy
primaryKey: 'pt_key',
Readonly
Optional
Overview
If your table has multiple columns in its primary key, you may use the full primary key definition syntax to express that:
Note that, if you don't have any clustering keys (partition sorts), you can omit the
partitionSort
field entirely:A sort of
1
on the clustering column means ascending, and a sort of -1 means descending.The shorthand syntax
If your table definition only has a single partition key, and no clustering keys (partition sorts), you can use the shorthand syntax instead: