Closed bholz closed 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
Yes, please read about before_save on your table. http://www.rubydoc.info/gems/mongify/Mongify/Database/Table
before_save
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