require "mongo"
require "pp"

Mongo::Logger.logger.level = Logger::FATAL

heroku = Mongo::Client.new("mongodb://heroku_28t66jgf:fuh9238ihgcgohss75qjt3sd7j@ds155201.mlab.com:55201/heroku_28t66jgf")
local  = Mongo::Client.new([ "127.0.0.1:27017" ], database: "heroku_28t66jgf")

last = local[:trades].find.sort(_id: -1).first

num = 0
heroku[:trades].find(_id: { "$gt": last["_id"] }).sort(_id: 1).each do |doc|
  local[:trades].insert_one(doc)
  num += 1
  if num % 100 == 0
    puts "#{doc['_id']}"
  end
end
