I'm currently trying to design a database pattern to store data that needs the ability to scale on demand. I'm looking at DynamoDB to complete this task. I'm not familiar with the no-sql design pattern and am having some trouble with going about the design. My data set, is to be tied to a camera system that tracks people entering and exiting a room.
My current design plan is to have a table that has the device id for the particular camera as the primary key. Every 5 minutes, the camera will send the total number into the room, the total out of the room, the group id (to track a room as a whole where there are multiple entrances/exits), and a timestamp.
My issue is that, DynamoDB seems to only want one entry for a given primary key. Whenever I want to make a new addition, It wants to overwrite my data.
I was thinking that a design such as the following may work:
DeviceID: ID
{
GroupID: ID,
Entries: [
{
In: numIN,
Out: numOUT,
TimeStamp: time
},
// appending on each entry to the list
]
}
Am I using DynamoDB inefficiently? Is there a better way to go about this? It seems like making queries, such as "how many people were in room x on day y?" would be difficult.