Reputation: 1626
Im trying to display itemts within a distance (from user's location). Only the loading screen appears. Error message appears on the terminal (server).
Publish
Meteor.publish('postsByDistance', function(currentLocation) {
return Posts.find({
loc: {
$near: {
}...
Upvotes: 1
Views: 1669
Reputation: 1424
You should check your arguments using check();
. Take a look at the docs for check(). In your case you should test against an Object (considering that the Geolocation.latLng()
function from the MDG package returns an Object)
Meteor.publish('postsByDistance', function(currentLocation) {
check(currentLocation, Object);
return Posts.find({
...
...
Also an option
check(currentLocation, Match.ObjectIncluding({lat: Number, lng: Number}))
Upvotes: 4