node.js - Meteor.js - mongodb - Leaflet.js - geo query from client to server - $within $box refresh - stack call size exceeded -


so have meteor.js project 'server' , 'client' folders. in there have leaflet.js map.

inside server.js have query show markers within bounding box. works fine. trying update marker when map moved encompass map's bounding box.

in ./server/server.js have startup methods:

 meteor.startup(function () {       meteor.methods({          buildcollections: function() {               locations = new meteor.collection('locations');              locations._ensureindex({'geometry.coordinates':'2dsphere'});         },         teststub: function(tst) {             console.log("test stub");             return tst;         },         showboundingbox: function(mapbox) {             return locations.find({                     'geometry.coordinates': {                         $within:{                             $box:mapbox                             }                         }                     });         }      });      meteor.call('buildcollections');   }); 

the showboundingbox method called server on publishing collection:

meteor.publish('locations', function() {             mapbox= [ [151.190,-33.94]                 ,[151.2,-33.84]] ;             return   meteor.call('showboundingbox',mapbox);  }); 

this works ok until want sent different bounding box based on map bounding box when leaflet map has been moved:

so in ./client/client.js want call server method update visible markers call server method:

window.map.on('moveend', function(e) {      var b = window.map.getbounds();     var bounds=[[b._southwest.lng,         b._southwest.lat],         [b._northeast.lng,         b._northeast.lat]         ];          meteor.call('teststub',"echoing client",         function(error,result){          if(error)         {         console.log(error.reason);         }else         {         console.log(result);         }          });           meteor.call('showboundingbox',bounds,         function(error,result){          if(error)         {         console.log(error.reason);         }else         {         console.log(result);         }          });     }); 

now teststub method returns string client, showboundingbox method crashes meteor error:

 internal exception while processing message{ msg: 'method',  method: 'showboundingbox',  params: [ [object], [object] ] ],  id: 'n' } maximum call stack size exceeded undefined 

where n incremented numerical index.

i trying update $within query new set of coordinates when map has been moved. legitimate bug? there way can achieve this?

got work being able monitor $within cursor using http://blog.benmcmahen.com/post/48367809759/meteors-reactive-data-sources


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -