Say I have an existing dataset in which something is an embedded document but we want to turn it into a reference instead. Is there any kind of automatic or semi-automatic way to do this refactoring.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Refactoring itself is simple. Just swap “embeds_one” for “has_one” (or substitute appropriate terms for your mapper library). It’s the data migration that will cause some pain. Or maybe it won’t. Here’s a small ruby script I whipped up in under 10 minutes. It should cover what I think you need.