Skip to content

Instantly share code, notes, and snippets.

@radiodario
Created April 27, 2011 09:38
Show Gist options
  • Save radiodario/943982 to your computer and use it in GitHub Desktop.
Save radiodario/943982 to your computer and use it in GitHub Desktop.
Updating things
Wish.find({}).sort('created_time', -1).execFind( function(err, data){
data.forEach( function (wish) {
console.log(wish.message);
geo.geocoder(geo.google, wish.location.name, false, function(formattedAddress, latitude, longitude) {
console.log('address: ' + wish.location.name + " resolved to " + formattedAddress + " (" + latitude + ', ' + longitude + ")" );
wish.location.lat = latitude;
wish.location.lng = longitude;
console.log('\t->' + wish.doc.location.lat + ', ' + wish.doc.location.lng);
wish.save(function(err) {
if (err)
console.log('error: ' + err)
else
console.log('success')
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment