So I have a collection in mongo with created_at fields, and I’m trying to add a sort_date attribute to each document, which will initially be equal to the created_at but modifiable by the user. I’m using Mongoid with Rails and trying to write a migration, and I’m wondering if there’s a clever (read: efficient) way to copy the value of one attribute to another without mapReduce or looping through the models in Ruby. Thanks!
So I have a collection in mongo with created_at fields, and I’m trying to
Share
Answering my own question:
Sadly, this seems to be the best option right now. At least it’s simpler than mapReduce, I suppose. Found the solution here.