Hi All,
With reference to Josh Owens’ Cityforks demo, I’ve gotten the get current location to work correctly and my app is not crashing but when I check Robomongo, the places collection is not populating the database.
I’ve copied the code exactly though:
Places = new Mongo.Collection(‘places’);
Meteor.methods({
‘fetchNearbyLocations’: function(coords) {
if (Meteor.isServer) {
results = HTTP.get(“https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=” + coords.latitude + “,” + coords.longitude + “&radius=500&types=food&key=AIzaSyCtfoCAldCEf8hXUlkVUd4UljqKR6W_aF4”)
console.log(results)
_(results.data.results).each(function(loc) {
_.extend(loc, {loc: {type: “Point”, coordinates: [loc.geometry.location.lng, loc.geometry.location.lat]}})
Places.upsert({id: loc.id}, {$set: loc})
});
}
}
});
Regarding the API key that I would of course change, which of these two keys is it?:
Inline image 1
I did remove autopublish, not sure if that makes a difference?
Also, would one have to add something like the below to a JS file somewhere within the project?
Any assistance would be greatly appreciated.