Help document structure, timestamp value


#1

Hi, I need to make a database for works with long amount of data. This database will save values in structure like: {timestamp, value, id, and name}. The access to this data will be similar to sql “select * from data whete id=1 and timestamp <= ‘2014/11/01’”

Which is the better way to save this data:

1.- multiple documents (one per value)
{
“driverid”:“12”,
“tagid”:“23”,
“name”:“fulano”,
“TS”:“201501012210”,
“Value”:“2.2”
}

2.- one document with array of all timestamps values pair

{
“driverid”:“12”,
“tagid”:“23”,
“name”:“fulano”,
“TSValueArray”:[{
“TS”:“201501012210”,“Value”:“2.2”
},{
“TS”:“201501012210”,“Value”:“2.2”
},{
“TS”:“201501012210”,“Value”:“2.3”
}]
}


#2

Hi, if the finer grain for your search is by day, than you should definitely store many values per document.