ruby on rails - Should dates be an embedded document? -
i using mongoid 3. have video model. should dates
embedded document or array
type?
if have structure:
{ :id => 2, :dates => [ { :date => time.now.strftime('%y%m%d').to_i, :views => { :non_uniques => 1, :uniques => 1, :countries => { :us => 1, :uk => 1 } }, :likes => 1, :comments => 1, } ] }
moreover, should views
, countries
embedded document?
as planning capture additional information date , think current schema correct . 1 aspect need consider , how going use data or query. if want see total views , likes video particular date think approach correct , if going show overall likes , view rather daily array better. typically doing correct sense of nosql , embedded document in last depends want query . here reading of daily statistic fast.
Comments
Post a Comment