Cityforks assistance

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.

I’ve just cloned and run cityforks and checked my database: the places collection is being updated.

So, that leaves a couple of things for you to check:

  1. Have you otherwise modified the code (you haven’t shown all of it) in any way? If you have, you should look there first.

  2. Maybe you are not looking in the right place with Robomongo. To check this, start your app and then from the command line, do:

    meteor mongo
    db.places.find()

If you see your data, then I would look to your use of Robomongo. If not, then please post a link to your full repo, or it will be next to impossible to offer further help.

Hi Rob,

I did an exact git clone and it is now working on my side as well. Thank you.

If I wanted to return, say, movie_theaters within a certain range or bars within another, for example, how would I create other collections that would populate the database in the same way? I don’t need the results to show up on the map necessarily.

Thank you.

Best,

Jay

I don’t know the application. I just looked at your problem and suggested places to look.

Sorry.