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

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -