Cassandra数据模型存储嵌入式文档

时间:2015-06-15 05:13:43

标签: mongodb database-design cassandra

在mongodb中,我们可以将嵌入的文档存储到一个集合中。然后,我们如何将嵌入的文档存储到cassandra中?对于此示例JSON表示???

UserProfile = {
name: "user profile",
Dave Jones: {
   email: {name: "email", value: "dave@email.com", timestamp: 125555555},
   userName: {name: "userName", value: "Dave", timestamp: 125555555}
},
Paul Simon: {
   email: {name: "email", value: "paul@email.com", timestamp: 125555555},
   phone: {name: "phone", value: "4155551212", timestamp: 125555555},
   userName: {name: "userName", value: "Paul", timestamp: 125555555}
}
}

1 个答案:

答案 0 :(得分:0)

如果您的文档嵌套级别不是太深,可以使用C * 2.1中的User Defined Types

我个人建议将您的架构重新考虑为更扁平的形式,如:

create table profiles ( name text, name2 text, email text, username text, ts timestamp, primary key (name,name2) // compound primary key! )