Skip to content

Instantly share code, notes, and snippets.

@arjones
Created February 15, 2010 19:01
Show Gist options
  • Save arjones/304887 to your computer and use it in GitHub Desktop.
Save arjones/304887 to your computer and use it in GitHub Desktop.
require 'mongo'
db = ::Mongo::Connection.new('genesis.mongohq.com', 27021).db('DB_DB_DB_DB_DB')
raise "Could not connect!" unless db.authenticate('USER_USER_USER_USER_USER', 'PASS_PASS_PASS_PASS_PASS')
feeds = db.collection('feeds')
comments = db.collection('comments')
query = {"options.language" => "pt"}
feeds.find(query).each do |feed|
target = feed['target']
puts target
where = {:target => target}
update_to = {"$set" => {"lang" => "pt"}}
comments.update(where, update_to, {:multi => true, :upsert => false})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment