I’m working on the backend of a Mobile Application that allows users to create public or private Parties and upload Video Stories for specific Parties.
I have previously used Scylla but I hit some roadblocks, like ttl expiration not being reported in CDC and no Geo search support. This pushed me towards trying to find out if Aerospike is suitable for our Data Model.
I have sketched out our Data Model once Denormalized and once Normalized and would appreciate some feedback in regards to which Model better fits Aerospike with our Access patterns. Or their might be a better data model better fitted than the two below.
Access Patterns:
CRUD on Parties and Stories through their id
.
Get all Parties of a User (Ordered by latest first).
Get all Stories of a User (Ordered by latest last).
Get all Stories of a Party (Ordered by latest last).
Denormalized
Party {
id: string,
user_id: string,
position: []float,
title text,
is_public boolean,
address: {
street_address: string,
postal_code: string,
state: string,
country: string,
},
created_at: string,
stories: [
{
id: string,
user_id: string,
position: []float,
url text,
tagged_friends: []string
created_at: string,
}
]
}
Normalized
Party {
id: string,
user_id: string,
position: []float,
title text,
is_public boolean,
address: {
street_address: string,
postal_code: string,
state: string,
country: string,
},
stories: []string, (list of story id’s)
}
Story {
id: string,
user_id: string,
position: []float,
url text,
tagged_friends: []string
created_at: string,
}
To achieve getting Parties/Stories of a specific User while still being able to access a Party/Story by their id
I think we would have to use the Normalized Model with a Secondary Index on the user_id
.
But I don’t know if ordering with a Secondary Index is possible since we want to return the latest Party of a User first and their latest Story last.
We off course also want to be able to paginate the requests of getting Stories/Parties of a User.