anlek / mongify

Mongify allows you to map your data from a sql database and into a mongodb document database.
http://github.com/anlek/mongify
MIT License
317 stars 82 forks source link

Can't find geoencoding #100

Open Deepankar01 opened 8 years ago

Deepankar01 commented 8 years ago

I tried searching for geo-location in mongify but it isn't there i have two different columns as LAT and LONG

table "tbb_buddy_group" do column "buddyGroupId", :integer column "userId", :integer column "LAT", :float column "LNG", :float column "groupId", :integer column "floating_LAT", :float column "floating_LNG", :float end how can i do geo-location using mongify ?

anlek commented 8 years ago

Wow, that's a great point, there isn't any geo-location setup, you might be able to do it via a before_save method.

Deepankar01 commented 8 years ago

before_Save do |row| row.LAT = Array[row.LAT,row.LNG] end

is this the right way ? all i want is to merge LAT LNG in a single array

anlek commented 8 years ago

You might want to remove the original values from the record

before_save do |row|
  row.location = Array(row.delete(:LAT), row.delete(:LNG))
end

The value will be stored in your db under location

Deepankar01 commented 8 years ago

thanks for the update yesterday i did thanks for the delete row.delete before_save do |row| row.loc = Array[row.LAT,row.LNG] end

anlek commented 8 years ago

Did it work out for you? If so, I can try adding it to the docs.

Deepankar01 commented 8 years ago

Yes yes I worked perfectly and please do add it in the docs As it will be really helpful

Thanks 😊

IsamAljawarneh commented 7 years ago

hi everybody, i need this also, the information provided here was helpful. i will test this with my database and provide you with feedback.