Thinkerer
Thinkerer

Reputation: 1626

Error: Did not check() all arguments during publisher

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

Answers (1)

Radu Chiriac
Radu Chiriac

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

Related Questions