我做错了什么?
db = Mongo::MongoClient.new(DB_URI)
tags = db['tags'].find()
tag_ids = tags.map { |t| t['_id'] }
puts tags.count
=> 4272
tags.each do |t|
puts t.inspect
end
=> # does not produce anything. As if it was empty.
如果我评论这一行
# tag_ids = tags.map { |t| t['_id'] }
,每种方法都能正常运行。
使用ruby 1.9.3p545
和gem mongo 1.9.2