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
318 stars 82 forks source link

Foreign Key reference id as string #77

Closed bholz closed 8 years ago

bholz commented 8 years ago

Hi, I have a foreign key relationship that I am keeping and everything works fine except that I would like it to store the value as a string and not an objectId

Here's an example of what I'm looking for Obj1: { "_id": ObjectId("123") }

Obj2: { "_id":ObjectId("987"), "obj1_id":"123" }

Is that doable? Thanks

anlek commented 8 years ago

Yes, please read about before_save on your table. http://www.rubydoc.info/gems/mongify/Mongify/Database/Table