Last active
December 18, 2015 16:09
-
-
Save jridgewell/5809098 to your computer and use it in GitHub Desktop.
mapReduce geoSpacial in Mongo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mongo_mapper' | |
map = %Q(function() { | |
lat_long = Math.floor(this.lat) + Math.floor(this.lon); | |
emit(lat_long, this.id); | |
}) | |
reduce = %Q(function(id, values) { | |
return vals; | |
}) | |
output_collection = "database.1by1" | |
collection.map_reduce(map, reduce, :out => output_collection).find() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment