-
-
Save marclove/293344 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :harmony do | |
desc "Munges the data" | |
task :munge => :environment do | |
docs_with_publish = Item.collection.find({'publish' => {'$exists' => true}}).to_a | |
puts "Item count: #{Item.count}" | |
puts "Items with publish key: #{docs_with_publish.size}" | |
docs_with_publish.each do |hash| | |
hash.delete('publish') | |
Item.collection.save(hash) | |
end | |
activities_with_thumbnail = Activity.collection.find({'source.thumbnail' => {'$exists' => true}}).to_a | |
puts "Activity count: #{Activity.count}" | |
puts "Activites with thumbnail: #{activities_with_thumbnail.size}" | |
activities_with_thumbnail.each do |hash| | |
hash['source'].delete('thumbnail') | |
Activity.collection.save(hash) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment