Javascript 使用$GEOIN订阅将返回空数组

Javascript 使用$GEOIN订阅将返回空数组,javascript,mongodb,meteor,meteor-blaze,Javascript,Mongodb,Meteor,Meteor Blaze,每次我试图从集合返回一些数据时,它都返回一个空数组。我正在使用iron router,这是我的代码: 客户: Meteor.call('insertEvent', { "eventLoc": { "type" : "Point", "coordinates": [ eventLongitude, eventLatitude ]} } function getBox() { var bou

每次我试图从集合返回一些数据时,它都返回一个空数组。我正在使用iron router,这是我的代码:

客户:

Meteor.call('insertEvent', {
    "eventLoc": {
        "type" : "Point",
        "coordinates": [ 
            eventLongitude, 
            eventLatitude
        ]}
}

function getBox() {
var bounds = GoogleMaps.maps.mapSeek.instance.getBounds();
var ne = bounds.getNorthEast();
var sw = bounds.getSouthWest();
    Session.set('box', [[sw.lat(),sw.lng()],[ne.lat(),ne.lng()]]);
}

getbox();
服务器:

Meteor.publish('publicPlaces', function(box) {
var find = {
    eventLoc: {
        $geoWithin: {
            $box: box
        }
    }
};

return Events.find(find);
});
路线:

Router.route('/seek', function () {
  this.render('seek');
  Meteor.subscribe('publicPlaces', Session.get('box'));
};

我想,错误在您的
框中。根据MongoDB手册,您必须首先指定经度,以及代码
Session.set('box',[[sw.lat(),sw.lng()],[ne.lat(),ne.lng()])
似乎正好相反。

当然,gah我很生气自己错过了这一点。非常感谢。