MongoDB Collection update: initialize a document with default values
I am trying to deal with time series using MongoDB. The common solution adopted by community is to use subdocuments to store information at different level of granularity (see Schema Design for Time Series Data in MongoDB ). For example, take a look at the following document: { timestamp_minute: ISODate("2013-10-10T23:06:00.000Z"), type: “memory_used”, values: [ 999999, // 1 second … 1000000, // nth second 1500000, // n+1th second … 2000000 // 60th ] } The document is indexed by minute information and contains a subdocument which store more detailed information for each second. So far so good.