Closed robertangeles closed 7 years ago
Hey @robertangeles,
If you have a database.config
file setup, execute the command mongify translation database.config
. This will go to your SQL database and grab all the tables and build a starter translation file.
From that point, you need to rewrite the translation to meet your needs.
Hope that helps, Andrew
HI @anlek! Thank you for the reply. I know you are a busy bee.
I am familiar with creating and processing translation files. What I am having issues with is how to structure it.
How can I create the translation file in a way where it will produce the structure of the document I have provided in my original post? My sincere apologies if I'm confusing you, I'm still trying to get my head around creating translations that embed documents. Initially, I would create it like the translation below but this will be a flat document. I would like the address details to be an embedded document.
table "properties" do column "propertyId", :string column "propertyName", :string column "addressLine", :string column "suburb", :string column "state"; :string column "postcode", :string column "status", :string column "subStatus", :string: end
Thanks!
Rob
Oh, I see, you only have one table and you're trying to restructure it. That's doable via before_save
helper:
table "properties" do
column "propertyId", :string
column "propertyName", :string
column "addressLine", :string
column "suburb", :string
column "state"; :string
column "postcode", :string
column "status", :string
column "subStatus", :string
before_save do |row|
row.address = {}
row.address['addressLine'] = row.delete('addressLine')
row.address['suburb'] = row.delete('suburb')
row.address['state'] = row.delete('state')
row.address['postalcode'] = row.delete('postalcode')
row
end
end
Feel free to read more about before_save and other features via: http://www.rubydoc.info/gems/mongify/
Hi fellow users of mongify and to you Andrew(@anlek) . I found mongify a couple of weeks ago and was thrilled that it can help us tremendously in moving our SQL Server data to mongoDB. I am very much from the world of RDBMS and doing my best to unlearn to learn the world of documents.
I already have a sandbox to play with and was wondering if I can ask for some assistance in creating translation files. I have read the getting started section but I may have overlooked or may have overthink how to do things the mongify way.
I have this simple table:
And I want to create a translation file to migrate it to mongodb collection:
I would greatly appreciate your assistance.
Thanks!
Rob