All right, I have read up on the collection2 and simpleSchema. I like the idea of using the schema so that on any insert it creates a time created at. I was wondering does
`new Date()`
create a time with month,day,year, hour,second? example code I have for the schema. Or would I need to format the incoming Date This is all untested because I will have to redo a lot of code and just working on some small things.
`var station = new SimpleSchema({
name: {
type: String,
label: "Station's Name",
},
longitude: {
type: Number
},
latitude: {
type: Number
},
createdAt: {
type: Date,
autoValue: function(){
if(this.isInsert){
return new Date();
}else if(this.isUpsert){
return {$setOnInsert: new Date()};
}else {
this.unset();
}
}
},
humidity: {
type: Number
},// Each sensor would look like this after.
});`
I really like the idea of only sending the newest 20 points from the server by a publisher. Is the publisher a constant hook? Is the publisher always sending the newest 20 points so that any new data will instantly be sent to the client subscription? If so I didnāt know it did that.
I do wish to show total number of data points per station. Would I just make another publisher and subscriber?
Also with template formatting would this be fine instead of having a Stations and station that I have a NodePage. When you click on the sidebar link to the Node(station) you want to visit it takes you to the NodePage and on there is
`<div class="Graphs">
{{> windDirection}}
{{> windSpeed}}
{{> temperature}}
{{> humidity}}
{{> pressure}}
{{> dewPoint}}
</div>`
Each of these is a link to a template for each graph on the page. Would this be fine or will this interfere with any onRendered orautorun? Each graph at the moment renders just fine and with spline seems to work great with just loading in the random data I have set for the testing.
You can see the full client side here.
clientsidegitHub
Theory question. Can a collection be too large for Meteor to handle? Because the theory is that there could be thousands of stations on this collection. And each station having around 45K points each. Also when I remove a said point from the collection is it like a delete row in excel where all the subsequent stations move up the ladder?