mongodb - Mobile Meteor App - calculating nearby locations and storing as sortable collection -


I'm putting a mobile meteorite application that I use to use local (within 20 miles radius) features Want to I have a collection of these features, which I would like to be able to pass in my current location (using Cordova) with current lately data and generate a list (/ archive?) First of all to generate Sorted

I have two specific problems on which I get some advice!

Can I use this for Mongo's $ pass or should I use it to calculate the distance node.js add-on (like 'Geolib '-)?

How do I get a temporary (locally stored) collection of these places to display in my list? Maybe if I do not use near $ then I have to calculate the distance at all those places, and then any distance must be returned, but it is below a certain limit, but This is a costly way to do this when my location list grows and grows.

Sorry, this is the first time I have tried to do something like this;

Edit - My code (Why is not it working ?!)

I am collecting collection of such places in a collection: < / P>

Beaches.insert ({name: 'Venice Beach CA', geometry: {type: "point", coordinates: [-118.473314,118.473314]}});

Beaches._ensureIndex ({'geometry.coordinates': '2D'}, function (hey, result) {if ( Mistake) console dir (err);});

I ask these entries like this (going through lat and lng):

getNearBeaches = function (LNG, lat) { Return Beaches.find ({'geometry.coordinates': {$ near: {$ geometry: {type: "point", coordinates: [lng, lat)}}, $ maxDistance: 20000 // meter}})};

I can list my collection directly with find () but my location search returns nothing, even if I have set E $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >

You can send the current location to not to the server and, to archive the subscription, MongoDB can be filtered by by $ < / Code>:

  Meteor.subscribe ("Facilities", {latlng: Session.get ("latlng")});  

and smth like this:

  Meteor.publish ("utilities", function (latlng) {return features. Search (search ({location: { Near $: {$ Geometry: {Type: "Point", Coordinate: LatLng}, $ maxDistance: 20000 // Meters}}})}};  

You must be Correct data type and indexed and field location (-:


Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -