2014-04-20 74 views
6

這有什麼CQL查詢CQL:壞請求:缺少聚類爲了

cqlsh> create table citybizz.notifications(
    ...  userId varchar, 
    ...  notifId UUID, 
    ...  notification varchar, 
    ...  time bigint,read boolean, 
    ...  primary key (userId, notifId,time) 
    ...) with clustering order by (time desc); 

它拋出Bad Request: Missing CLUSTERING ORDER for column notifid問題。我使用卡桑德拉1.2.2

回答

8

您需要爲notifId指定的順序也:

create table citybizz.notifications(
    userId varchar, 
    notifId UUID, 
    notification varchar, 
    time bigint,read boolean, 
    primary key (userId, notifId,time) 
) with clustering order by (notifId asc, time desc); 

卡桑德拉不承擔其他簇鍵的默認排序(ASC),所以你需要指定它。