So I’m using mongoid in my rails app and have been referencing all of my class relations by default. I’ve realized some of these would be better off being embedded and was just wondering if there are any extra steps to take besides just changing has_many to embeds_many, etc.
Share
You’ll need to create new embedded docs for each doc that exists in another collection.
For example, say you have Post and Comment, and Comment belongs to Post. Right now, your comments are in a collection called “comments”. You’re going to need to iterate through each of your posts or comments, and create an embedded comment in the correct post.