我打算使用低架构更改将我的应用程序数据库从MysqL迁移到Mongo.在我的新模式中,我将两个MysqL表合并为一个Mongo集合.我想使用mongify(https://github.com/anlek/mongify)gem将我现有的MysqL数据填充到Mongo中,使用更新的模式.
这该怎么做?有没有办法在mongify中将两个MysqL表合并为一个?
user
id
name
nickname
type
user_role
id
role
alias
user_id
我将以上两个表合并为Mongo中的单个集合
user
id
name
type
role
alias
最佳答案
尝试左连接:(表将合并)
原文链接:https://www.f2er.com/mysql/433216.htmlSELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name=table2.column_name;
SELECT country INTO customerCountry
FROM customers
WHERE customerNumber = p_customerNumber;
CASE customerCountry -- Here you have to see if that alias data is set
WHEN 'USA' THEN
SET p_shiping = '2-day Shipping'; -- here you have to write Update Query
ELSE
SET p_shiping = '5-day Shipping';
END CASE;
我想这可能会对你有所帮助