Error: Did not check() all arguments during publisher

Error: Did not check() all arguments during publisher

我正在尝试在一定距离内(从用户位置)显示项目。仅显示加载屏幕。终端(服务器)上出现错误消息。

发布

  Meteor.publish('postsByDistance', function(currentLocation) { 
    return Posts.find({
      loc: { 
        $near: { 
        }...

您应该使用 check(); 检查您的论点。查看 check() 的文档。在您的情况下,您应该针对一个对象进行测试(考虑到 MDG 包中的 Geolocation.latLng() 函数 returns 一个对象)

Meteor.publish('postsByDistance', function(currentLocation) { 
    check(currentLocation, Object);
    return Posts.find({
...
...

也是一个选项

check(currentLocation, Match.ObjectIncluding({lat: Number, lng: Number}))