Commit d60532a1 authored by David Haynes's avatar David Haynes

SimpleSchema being tried auto

- will we use it idk
- does it work? no
- but that's part of the fun
- also a collection should be plural and PascalCase
parent 3eb58ac3
......@@ -21,3 +21,4 @@ http@1.2.9
standard-minifier-css@1.2.0
standard-minifier-js@1.2.0
shell-server
aldeed:simple-schema # Schema support for db
aldeed:simple-schema@1.5.3
allow-deny@1.0.5
autoupdate@1.3.11
babel-compiler@6.9.1
......@@ -34,6 +35,7 @@ jquery@1.11.9
launch-screen@1.0.12
livedata@1.0.18
logging@1.1.15
mdg:validation-error@0.2.0
meteor@1.2.17
meteor-base@1.0.4
minifier-css@1.2.14
......
import { Mongo } from 'meteor/mongo';
export const WeatherData = new Mongo.Collection('weather-data');
export const WeatherData = new Mongo.Collection('WeatherDatas');
WeatherData.schema = new SimpleSchema({
name: {
type: String,
label: "The name of the GMU Campus"
},
lat: {
type: Number,
label: "The latitude of the GMU Campus"
},
long: {
type: Number,
label: "The logiute of the GMU Campus"
},
data: {
type: Object,
label: "The most current weather entry for this location"
},
lastUpdated: {
type: Date,
label: "The last time that this campus's current forecast was updated"
}
})
Meteor.methods({
'weatherDataForLoc': function (lat, long) {
......@@ -21,6 +44,7 @@ export function refreshData() {
Meteor.call('weatherDataForLoc', current.lat, current.long, function(err, res){
currentData = res
});
/**
WeatherData.insert ({
name: current.name,
lat: current.lat,
......@@ -28,5 +52,15 @@ export function refreshData() {
data: currentData,
lastUpdated: new Date(),
});
*/
let location = {
name: current.name,
lat: current.lat,
long: current.long,
data: currentData,
lastUpdated: new Date(),
}
WeatherData.schema.validate(location);
WeatherData.insert(location);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment