Created
February 15, 2010 19:01
-
-
Save arjones/304887 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
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