Closed dinhkhanh closed 8 years ago
I figured out why it din't work.
Mongify takes ParentID
value as string, that's why it cannot recognize the id to reference.
Just a slightly modify to make it work.
table "Category", :rename_to => 'categories' do
column "CatID", :key
column "SectionID", :integer, :ignore => true
column "ParentID", :integer, :rename_to => 'parent', :references => :categories
column "CatName", :string, :rename_to => 'title'
column "CatNameAlias", :string, :rename_to => 'slug'
column "Active", :integer, :rename_to => 'is_active'
column "CatMetaTitle", :text, :rename_to => 'meta_title'
column "CatMetaDescription", :text, :rename_to => 'meta_description'
column "CatMetaKeywords", :text, :rename_to => 'meta_keywords'
before_save do |row|
row.parent = (row.parent).to_i
end
end
(row.parent).to_i
convert the value to integer. Now it can make the refernces correctly.
I connect databases, translate and process successfully.
Problem is
parent
field in MongoDB document keeps using value of ParentID in MySQL. It's expected to be an ObjectID references to acategories
document.How to correct it?
Thanks in advanced.