I think the first option is not a viable solution. You'll end up with some (few) station records that will become of huge size because of embedding observations.
In terms of MongoDB
I would suggest:
- a collection for stations that embeds a a fixed amount of observations (with the observations for the last 30 days or so)
- an observations collection that will act as a warehouse
stations: [
{
id: sta_1234,
observations: [ {observation_id: obs_1234, observation_data: {} }, ...]
}, ...
]
were observations has a fixed size.
that way
- you can have a quick reference to recent observations.
- you will have fixed sized docs (which is very good for mongo!)
you will not lose any history
Actually
observations
may be better off asobservation_ids
and you keep there only the ids, or some useful data about each observation
a "drawback" about it is that you'll have to use raw mongo at some points cause mongoid does not support everything (yet), but I think the benefits are greater.
With this approach you 'll have to handle the duplicate data on insertion in your app, which should be no problem.