Adding lat and lon fields to a SimpleSchema declaration


#1

Hey guys so i’m trying to add lat and lon fields to a collection, but I’m getting stuck in the autovalue part.

Any help will be greatly appreciated. What I have now:


FritkotSchema = new SimpleSchema({
	location: {
		type: Object,
		index: '2dsphere',
		label: 'Location',
		autoform: {
			type: 'hidden',
			omit: true
		}
	},
	'location.type': {
		type: String,
		allowedValues: ['Point'],
		label: 'Star location type'
	},
	'location.coordinates': {
		type: [Number],
		minCount: 2,
		maxCount: 2,
		decimal: true,
		autoValue: function () {
			// [QUESTION]: What to add here ??
		}
	},
        name: {
		type: String,
		label: 'Name'
	},
	address: {
		type: String,
		label: 'Address',
	},
	postCode: {
		type: String,
		label: 'PostCode'
	},
	gemeente: {
		type: String,
		label: 'Gemeente'
	},
... omitted code

#2

You can just omit autoValue. You dont need it


#3

But how best then to force that the location lat and lng are added and/or computed to my collection