Michael
Michael

Reputation: 31

meteor simple-schema fpr time-series data

i'm a beginner with meteor. I' want to get a database collection in meteor for time-series data like at MongoDb Blog. They have explained a Mongo Schema which should work fine for time series data. The Collection should look like this:

{
  timestamp_minute: ISODate(“2013-10-10T23:06:00.000Z”),
  num_samples: 58,
  total_samples: 108000000,
  type: “memory_used”,
  values: {
    0: 999999,
    …  
    37: 1000000,
    38: 1500000,
    … 
    59: 1800000
  }
}

All the fields are easy to get expect the values field.

Two question for this:

Do i have to make a own schema vor the values field? like

sensorValues = new SimpleSchema ({
      0: {
          type: Number
      },
      ...,
      59: {
          type: Number
      }
})  

second: If yes why i can't access values.0 and i have to use a string like values.value0 and have to change the schema like this?.

sensorValues = new SimpleSchema ({
      values0: {
          type: Number
      },
      ...,
      values59: {
          type: Number
      }
})

Maybe somebod can help me to get the Collection like explained at the meteor blog.

thanks for your help.

greetings Michael

Upvotes: 0

Views: 113

Answers (1)

Volen Todorov
Volen Todorov

Reputation: 30

You can define values as an array of numbers.

values: {
type: [Number]
}

Upvotes: 0

Related Questions