everytime try return data collection returns empty array. i'm using iron router , code:
client:
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();
server:
meteor.publish('publicplaces', function(box) { var find = { eventloc: { $geowithin: { $box: box } } }; return events.find(find); });
routes:
router.route('/seek', function () { this.render('seek'); meteor.subscribe('publicplaces', session.get('box')); };
i think, error in box
value. according mongodb manual have specify longitude first, , code session.set('box', [[sw.lat(),sw.lng()],[ne.lat(),ne.lng()]]);
seems conversely.
Comments
Post a Comment