Skip to content

Instantly share code, notes, and snippets.

@perlun
Last active August 4, 2017 12:37
Show Gist options
  • Save perlun/c49899bfc2c957ae2b46f2a331f485a1 to your computer and use it in GitHub Desktop.
Save perlun/c49899bfc2c957ae2b46f2a331f485a1 to your computer and use it in GitHub Desktop.
mongo leak test

To import this data, use the following command:

$ mongoimport --db time --collection holidays --upsert < holidays.json

Then run the leaktest.rb like this (adding a Gemfile with the mongo gem etc):

$ bundle exec ./leaktest.rb

You can then analyze the generated heap dump and get an output similar to this (gem install heapy if it isn't already installed), which indicates that many objects are incorrectly retained on the heap:

$ heapy read /tmp/dump.json

Analyzing Heap
==============
Generation: nil object count: 45862
Generation:  59 object count: 8743
Generation:  60 object count: 3640
Generation:  61 object count: 3323
Generation:  62 object count: 2947
Generation:  63 object count: 2493
Generation:  64 object count: 1750
Generation:  65 object count: 1521
Generation:  66 object count: 845
Generation:  67 object count: 2111
Generation:  68 object count: 1382
Generation:  69 object count: 1239
Generation:  70 object count: 1183
Generation:  71 object count: 1183
Generation:  72 object count: 507
Generation:  73 object count: 3632
Generation:  74 object count: 2959
Generation:  75 object count: 2757
Generation:  76 object count: 2651
Generation:  77 object count: 2497
Generation:  78 object count: 2343
Generation:  79 object count: 2248
Generation:  80 object count: 2038
Generation:  81 object count: 1014
Generation:  82 object count: 2704
Generation:  83 object count: 1759
Generation:  84 object count: 1663
Generation:  85 object count: 1648
Generation:  86 object count: 676
Generation:  87 object count: 5010
Generation:  88 object count: 4008
Generation:  89 object count: 3826
Generation:  90 object count: 3549
Generation:  91 object count: 3380
Generation:  92 object count: 3211
Generation:  93 object count: 3042
Generation:  94 object count: 2873
Generation:  95 object count: 2704
Generation:  96 object count: 2535
Generation:  97 object count: 2366
Generation:  98 object count: 2257
Generation:  99 object count: 2137
Generation: 100 object count: 1014
Generation: 101 object count: 6855
Generation: 102 object count: 5533
Generation: 103 object count: 5249
Generation: 104 object count: 5009
Generation: 105 object count: 4623
Generation: 106 object count: 4443
Generation: 107 object count: 4116
Generation: 108 object count: 3887
Generation: 109 object count: 3718
Generation: 110 object count: 3549
Generation: 111 object count: 3320
Generation: 112 object count: 3102
Generation: 113 object count: 2934
Generation: 114 object count: 1400
Generation: 115 object count: 9355
Generation: 116 object count: 507
Generation: 117 object count: 3719
Generation: 118 object count: 11072
Generation: 119 object count: 2585
Generation: 120 object count: 90

If the get_connection method is modified like this:

def get_connection
  @client ||= begin
    mongo_uri = 'mongodb://localhost/time'
    options = {}
    Mongo::Client.new(mongo_uri, options)
  end
end

...the memory leak is worked around, and the heapy session will instead look like this. A much lower number of retained objects:

$ heapy read /tmp/dump.json

Analyzing Heap
==============
Generation: nil object count: 45865
Generation:  59 object count: 8743
Generation:  60 object count: 3640
Generation:  61 object count: 3323
Generation:  62 object count: 2946
Generation:  63 object count: 1722
Generation: 128 object count: 8
Generation: 129 object count: 89
Generation: 130 object count: 825
Generation: 131 object count: 35
{"_id":{"$oid":"526fb09bf27d64a2a5e80ecd"},"country":"SE","date":"2010-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ece"},"country":"FI","date":"2010-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ecf"},"country":"SE","date":"2010-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ed0"},"country":"FI","date":"2010-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ed1"},"country":"FI","date":"2010-02-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ed2"},"country":"FI","date":"2010-02-14"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ed3"},"country":"FI","date":"2010-03-28"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ed4"},"country":"FI","date":"2010-03-28"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ed5"},"country":"FI","date":"2010-04-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ed6"},"country":"SE","date":"2010-04-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ed7"},"country":"FI","date":"2010-04-04"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ed8"},"country":"SE","date":"2010-04-04"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ed9"},"country":"FI","date":"2010-04-05"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80eda"},"country":"SE","date":"2010-04-05"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80edb"},"country":"SE","date":"2010-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80edc"},"country":"FI","date":"2010-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80edd"},"country":"FI","date":"2010-05-09"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ede"},"country":"SE","date":"2010-05-13"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80edf"},"country":"FI","date":"2010-05-13"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ee0"},"country":"FI","date":"2010-05-16"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ee1"},"country":"SE","date":"2010-05-23"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ee2"},"country":"FI","date":"2010-05-23"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ee3"},"country":"FI","date":"2010-05-30"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ee4"},"country":"SE","date":"2010-06-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ee5"},"country":"FI","date":"2010-06-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ee6"},"country":"SE","date":"2010-06-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ee7"},"country":"FI","date":"2010-07-18"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ee8"},"country":"FI","date":"2010-10-03"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ee9"},"country":"FI","date":"2010-11-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80eea"},"country":"SE","date":"2010-11-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80eeb"},"country":"FI","date":"2010-11-14"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80eec"},"country":"FI","date":"2010-11-21"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80eed"},"country":"FI","date":"2010-12-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80eee"},"country":"SE","date":"2010-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80eef"},"country":"FI","date":"2010-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ef0"},"country":"FI","date":"2010-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ef1"},"country":"SE","date":"2010-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ef2"},"country":"SE","date":"2011-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ef3"},"country":"FI","date":"2011-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ef4"},"country":"SE","date":"2011-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ef5"},"country":"FI","date":"2011-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ef6"},"country":"FI","date":"2011-02-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ef7"},"country":"FI","date":"2011-03-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ef8"},"country":"FI","date":"2011-03-27"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ef9"},"country":"FI","date":"2011-04-17"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80efa"},"country":"FI","date":"2011-04-22"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80efb"},"country":"SE","date":"2011-04-22"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80efc"},"country":"FI","date":"2011-04-24"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80efd"},"country":"SE","date":"2011-04-24"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80efe"},"country":"FI","date":"2011-04-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80eff"},"country":"SE","date":"2011-04-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f00"},"country":"FI","date":"2011-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f01"},"country":"SE","date":"2011-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f02"},"country":"FI","date":"2011-05-08"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f03"},"country":"FI","date":"2011-05-15"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f04"},"country":"FI","date":"2011-06-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f05"},"country":"SE","date":"2011-06-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f06"},"country":"SE","date":"2011-06-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f07"},"country":"FI","date":"2011-06-12"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f08"},"country":"SE","date":"2011-06-12"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f09"},"country":"FI","date":"2011-06-19"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f0a"},"country":"SE","date":"2011-06-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f0b"},"country":"FI","date":"2011-06-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f0c"},"country":"FI","date":"2011-08-07"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f0d"},"country":"FI","date":"2011-10-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f0e"},"country":"SE","date":"2011-11-05"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f0f"},"country":"FI","date":"2011-11-05"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f10"},"country":"FI","date":"2011-11-13"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f11"},"country":"FI","date":"2011-11-20"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f12"},"country":"FI","date":"2011-12-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f13"},"country":"FI","date":"2011-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f14"},"country":"SE","date":"2011-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f15"},"country":"FI","date":"2011-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f16"},"country":"SE","date":"2011-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f17"},"country":"FI","date":"2012-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f18"},"country":"SE","date":"2012-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f19"},"country":"FI","date":"2012-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f1a"},"country":"SE","date":"2012-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f1b"},"country":"FI","date":"2012-02-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f1c"},"country":"FI","date":"2012-02-19"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f1d"},"country":"FI","date":"2012-03-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f1e"},"country":"FI","date":"2012-04-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f1f"},"country":"FI","date":"2012-04-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f20"},"country":"SE","date":"2012-04-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f21"},"country":"FI","date":"2012-04-08"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f22"},"country":"SE","date":"2012-04-08"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f23"},"country":"FI","date":"2012-04-09"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f24"},"country":"SE","date":"2012-04-09"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f25"},"country":"SE","date":"2012-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f26"},"country":"FI","date":"2012-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f27"},"country":"FI","date":"2012-05-13"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f28"},"country":"SE","date":"2012-05-17"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f29"},"country":"FI","date":"2012-05-17"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f2a"},"country":"FI","date":"2012-05-20"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f2b"},"country":"SE","date":"2012-05-27"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f2c"},"country":"FI","date":"2012-05-27"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f2d"},"country":"FI","date":"2012-06-03"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f2e"},"country":"SE","date":"2012-06-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f2f"},"country":"SE","date":"2012-06-23"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f30"},"country":"FI","date":"2012-06-23"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f31"},"country":"FI","date":"2012-07-22"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f32"},"country":"FI","date":"2012-09-30"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f33"},"country":"SE","date":"2012-11-03"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f34"},"country":"FI","date":"2012-11-03"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f35"},"country":"FI","date":"2012-11-11"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f36"},"country":"FI","date":"2012-11-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f37"},"country":"FI","date":"2012-12-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f38"},"country":"FI","date":"2012-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f39"},"country":"SE","date":"2012-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f3a"},"country":"SE","date":"2012-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f3b"},"country":"FI","date":"2012-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f3c"},"country":"FI","date":"2013-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f3d"},"country":"SE","date":"2013-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f3e"},"country":"SE","date":"2013-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f3f"},"country":"FI","date":"2013-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f40"},"country":"FI","date":"2013-02-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f41"},"country":"FI","date":"2013-02-10"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f42"},"country":"FI","date":"2013-03-24"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f43"},"country":"FI","date":"2013-03-24"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f44"},"country":"SE","date":"2013-03-29"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f45"},"country":"FI","date":"2013-03-29"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f46"},"country":"FI","date":"2013-03-31"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f47"},"country":"SE","date":"2013-03-31"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f48"},"country":"FI","date":"2013-04-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f49"},"country":"SE","date":"2013-04-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f4a"},"country":"FI","date":"2013-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f4b"},"country":"SE","date":"2013-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f4c"},"country":"FI","date":"2013-05-09"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f4d"},"country":"SE","date":"2013-05-09"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f4e"},"country":"FI","date":"2013-05-12"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f4f"},"country":"FI","date":"2013-05-19"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f50"},"country":"FI","date":"2013-05-19"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f51"},"country":"SE","date":"2013-05-19"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f52"},"country":"FI","date":"2013-05-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f53"},"country":"SE","date":"2013-06-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f54"},"country":"SE","date":"2013-06-22"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f55"},"country":"FI","date":"2013-06-22"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f56"},"country":"FI","date":"2013-07-14"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f57"},"country":"FI","date":"2013-09-29"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f58"},"country":"SE","date":"2013-11-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f59"},"country":"FI","date":"2013-11-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f5a"},"country":"FI","date":"2013-11-10"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f5b"},"country":"FI","date":"2013-11-24"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f5c"},"country":"FI","date":"2013-12-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f5d"},"country":"FI","date":"2013-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f5e"},"country":"SE","date":"2013-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f5f"},"country":"FI","date":"2013-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f60"},"country":"SE","date":"2013-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f61"},"country":"FI","date":"2014-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f62"},"country":"SE","date":"2014-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f63"},"country":"FI","date":"2014-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f64"},"country":"SE","date":"2014-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f65"},"country":"FI","date":"2014-02-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f66"},"country":"FI","date":"2014-03-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f67"},"country":"FI","date":"2014-03-23"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f68"},"country":"FI","date":"2014-04-13"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f69"},"country":"FI","date":"2014-04-18"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f6a"},"country":"SE","date":"2014-04-18"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f6b"},"country":"SE","date":"2014-04-20"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f6c"},"country":"FI","date":"2014-04-20"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f6d"},"country":"SE","date":"2014-04-21"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f6e"},"country":"FI","date":"2014-04-21"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f6f"},"country":"SE","date":"2014-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f70"},"country":"FI","date":"2014-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f71"},"country":"FI","date":"2014-05-11"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f72"},"country":"FI","date":"2014-05-18"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f73"},"country":"FI","date":"2014-05-29"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f74"},"country":"SE","date":"2014-05-29"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f75"},"country":"SE","date":"2014-06-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f76"},"country":"SE","date":"2014-06-08"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f77"},"country":"FI","date":"2014-06-08"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f78"},"country":"FI","date":"2014-06-15"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f79"},"country":"FI","date":"2014-06-21"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f7a"},"country":"SE","date":"2014-06-21"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f7b"},"country":"FI","date":"2014-08-03"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f7c"},"country":"FI","date":"2014-10-05"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f7d"},"country":"FI","date":"2014-11-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f7e"},"country":"SE","date":"2014-11-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f7f"},"country":"FI","date":"2014-11-09"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f80"},"country":"FI","date":"2014-11-23"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f81"},"country":"FI","date":"2014-12-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f82"},"country":"FI","date":"2014-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f83"},"country":"SE","date":"2014-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f84"},"country":"FI","date":"2014-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f85"},"country":"SE","date":"2014-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f86"},"country":"FI","date":"2015-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f87"},"country":"SE","date":"2015-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f88"},"country":"SE","date":"2015-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f89"},"country":"FI","date":"2015-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f8b"},"country":"FI","date":"2015-02-15"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f8c"},"country":"FI","date":"2015-03-22"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f8d"},"country":"FI","date":"2015-03-29"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f8e"},"country":"FI","date":"2015-04-03"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f8f"},"country":"SE","date":"2015-04-03"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f90"},"country":"FI","date":"2015-04-05"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f91"},"country":"SE","date":"2015-04-05"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f92"},"country":"FI","date":"2015-04-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f93"},"country":"SE","date":"2015-04-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f94"},"country":"FI","date":"2015-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f95"},"country":"SE","date":"2015-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f96"},"country":"FI","date":"2015-05-10"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f97"},"country":"SE","date":"2015-05-14"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f98"},"country":"FI","date":"2015-05-14"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f99"},"country":"FI","date":"2015-05-17"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f9a"},"country":"SE","date":"2015-05-24"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f9b"},"country":"FI","date":"2015-05-24"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f9c"},"country":"FI","date":"2015-05-31"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f9d"},"country":"SE","date":"2015-06-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f9e"},"country":"SE","date":"2015-06-20"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80f9f"},"country":"FI","date":"2015-06-20"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fa0"},"country":"FI","date":"2015-07-19"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fa1"},"country":"FI","date":"2015-10-04"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fa2"},"country":"SE","date":"2015-10-31"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fa3"},"country":"FI","date":"2015-10-31"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fa4"},"country":"FI","date":"2015-11-08"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fa5"},"country":"FI","date":"2015-11-22"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fa6"},"country":"FI","date":"2015-12-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fa7"},"country":"FI","date":"2015-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fa8"},"country":"SE","date":"2015-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fa9"},"country":"FI","date":"2015-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80faa"},"country":"SE","date":"2015-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fab"},"country":"FI","date":"2016-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fac"},"country":"SE","date":"2016-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fad"},"country":"FI","date":"2016-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fae"},"country":"SE","date":"2016-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fb0"},"country":"FI","date":"2016-02-07"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fb1"},"country":"FI","date":"2016-03-20"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fb2"},"country":"FI","date":"2016-03-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fb3"},"country":"SE","date":"2016-03-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fb4"},"country":"FI","date":"2016-03-27"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fb5"},"country":"FI","date":"2016-03-27"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fb6"},"country":"SE","date":"2016-03-27"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fb7"},"country":"FI","date":"2016-03-28"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fb8"},"country":"SE","date":"2016-03-28"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fb9"},"country":"FI","date":"2016-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fba"},"country":"SE","date":"2016-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fbb"},"country":"FI","date":"2016-05-05"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fbc"},"country":"SE","date":"2016-05-05"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fbd"},"country":"FI","date":"2016-05-08"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fbe"},"country":"FI","date":"2016-05-15"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fbf"},"country":"FI","date":"2016-05-15"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fc0"},"country":"SE","date":"2016-05-15"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fc1"},"country":"FI","date":"2016-05-22"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fc2"},"country":"SE","date":"2016-06-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fc3"},"country":"SE","date":"2016-06-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fc4"},"country":"FI","date":"2016-06-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fc5"},"country":"FI","date":"2016-07-10"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fc6"},"country":"FI","date":"2016-10-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fc7"},"country":"FI","date":"2016-11-05"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fc8"},"country":"SE","date":"2016-11-05"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fc9"},"country":"FI","date":"2016-11-13"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fca"},"country":"FI","date":"2016-11-20"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fcb"},"country":"FI","date":"2016-12-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fcc"},"country":"FI","date":"2016-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fcd"},"country":"SE","date":"2016-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fce"},"country":"FI","date":"2016-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fcf"},"country":"SE","date":"2016-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fd0"},"country":"FI","date":"2017-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fd1"},"country":"SE","date":"2017-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fd2"},"country":"FI","date":"2017-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fd3"},"country":"SE","date":"2017-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fd5"},"country":"FI","date":"2017-02-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fd6"},"country":"FI","date":"2017-03-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fd7"},"country":"FI","date":"2017-04-09"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fd8"},"country":"FI","date":"2017-04-14"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fd9"},"country":"SE","date":"2017-04-14"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fda"},"country":"FI","date":"2017-04-16"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fdb"},"country":"SE","date":"2017-04-16"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fdc"},"country":"SE","date":"2017-04-17"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fdd"},"country":"FI","date":"2017-04-17"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fde"},"country":"SE","date":"2017-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fdf"},"country":"FI","date":"2017-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fe0"},"country":"FI","date":"2017-05-14"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fe1"},"country":"FI","date":"2017-05-21"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fe2"},"country":"FI","date":"2017-05-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fe3"},"country":"SE","date":"2017-05-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fe4"},"country":"FI","date":"2017-06-04"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fe5"},"country":"SE","date":"2017-06-04"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fe6"},"country":"SE","date":"2017-06-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fe7"},"country":"FI","date":"2017-06-11"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fe8"},"country":"FI","date":"2017-06-24"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fe9"},"country":"SE","date":"2017-06-24"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fea"},"country":"FI","date":"2017-07-30"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80feb"},"country":"FI","date":"2017-10-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fec"},"country":"FI","date":"2017-11-04"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fed"},"country":"SE","date":"2017-11-04"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fee"},"country":"FI","date":"2017-11-12"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fef"},"country":"FI","date":"2017-11-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ff0"},"country":"FI","date":"2017-12-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ff1"},"country":"FI","date":"2017-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ff2"},"country":"SE","date":"2017-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ff3"},"country":"FI","date":"2017-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ff4"},"country":"SE","date":"2017-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ff5"},"country":"SE","date":"2018-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ff6"},"country":"FI","date":"2018-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ff7"},"country":"FI","date":"2018-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ff8"},"country":"SE","date":"2018-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ff9"},"country":"FI","date":"2018-02-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ffa"},"country":"FI","date":"2018-02-11"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ffb"},"country":"FI","date":"2018-03-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ffc"},"country":"FI","date":"2018-03-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ffd"},"country":"SE","date":"2018-03-30"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80ffe"},"country":"FI","date":"2018-03-30"}
{"_id":{"$oid":"526fb09bf27d64a2a5e80fff"},"country":"FI","date":"2018-04-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81000"},"country":"SE","date":"2018-04-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81001"},"country":"FI","date":"2018-04-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81002"},"country":"SE","date":"2018-04-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81003"},"country":"FI","date":"2018-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81004"},"country":"SE","date":"2018-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81005"},"country":"FI","date":"2018-05-10"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81006"},"country":"SE","date":"2018-05-10"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81007"},"country":"FI","date":"2018-05-13"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81008"},"country":"SE","date":"2018-05-20"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81009"},"country":"FI","date":"2018-05-20"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8100a"},"country":"FI","date":"2018-05-20"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8100b"},"country":"FI","date":"2018-05-27"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8100c"},"country":"SE","date":"2018-06-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8100d"},"country":"SE","date":"2018-06-23"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8100e"},"country":"FI","date":"2018-06-23"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8100f"},"country":"FI","date":"2018-07-15"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81010"},"country":"FI","date":"2018-09-30"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81011"},"country":"SE","date":"2018-11-03"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81012"},"country":"FI","date":"2018-11-03"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81013"},"country":"FI","date":"2018-11-11"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81014"},"country":"FI","date":"2018-11-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81015"},"country":"FI","date":"2018-12-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81016"},"country":"FI","date":"2018-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81017"},"country":"SE","date":"2018-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81018"},"country":"FI","date":"2018-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81019"},"country":"SE","date":"2018-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8101a"},"country":"FI","date":"2019-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8101b"},"country":"SE","date":"2019-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8101c"},"country":"FI","date":"2019-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8101d"},"country":"SE","date":"2019-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8101e"},"country":"FI","date":"2019-02-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8101f"},"country":"FI","date":"2019-03-03"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81020"},"country":"FI","date":"2019-03-24"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81021"},"country":"FI","date":"2019-04-14"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81022"},"country":"FI","date":"2019-04-19"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81023"},"country":"SE","date":"2019-04-19"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81024"},"country":"FI","date":"2019-04-21"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81025"},"country":"SE","date":"2019-04-21"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81026"},"country":"FI","date":"2019-04-22"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81027"},"country":"SE","date":"2019-04-22"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81028"},"country":"FI","date":"2019-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81029"},"country":"SE","date":"2019-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8102a"},"country":"FI","date":"2019-05-12"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8102b"},"country":"FI","date":"2019-05-19"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8102c"},"country":"FI","date":"2019-05-30"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8102d"},"country":"SE","date":"2019-05-30"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8102e"},"country":"SE","date":"2019-06-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8102f"},"country":"FI","date":"2019-06-09"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81030"},"country":"SE","date":"2019-06-09"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81031"},"country":"FI","date":"2019-06-16"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81032"},"country":"FI","date":"2019-06-22"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81033"},"country":"SE","date":"2019-06-22"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81034"},"country":"FI","date":"2019-08-04"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81035"},"country":"FI","date":"2019-09-29"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81036"},"country":"FI","date":"2019-11-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81037"},"country":"SE","date":"2019-11-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81038"},"country":"FI","date":"2019-11-10"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81039"},"country":"FI","date":"2019-11-24"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8103a"},"country":"FI","date":"2019-12-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8103b"},"country":"FI","date":"2019-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8103c"},"country":"SE","date":"2019-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8103d"},"country":"FI","date":"2019-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8103e"},"country":"SE","date":"2019-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8103f"},"country":"FI","date":"2020-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81040"},"country":"SE","date":"2020-01-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81041"},"country":"FI","date":"2020-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81042"},"country":"SE","date":"2020-01-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81043"},"country":"FI","date":"2020-02-02"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81044"},"country":"FI","date":"2020-02-23"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81045"},"country":"FI","date":"2020-03-22"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81046"},"country":"FI","date":"2020-04-05"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81047"},"country":"FI","date":"2020-04-10"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81048"},"country":"SE","date":"2020-04-10"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81049"},"country":"FI","date":"2020-04-12"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8104a"},"country":"SE","date":"2020-04-12"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8104b"},"country":"FI","date":"2020-04-13"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8104c"},"country":"SE","date":"2020-04-13"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8104d"},"country":"FI","date":"2020-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8104e"},"country":"SE","date":"2020-05-01"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8104f"},"country":"FI","date":"2020-05-10"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81050"},"country":"FI","date":"2020-05-17"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81051"},"country":"SE","date":"2020-05-21"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81052"},"country":"FI","date":"2020-05-21"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81053"},"country":"FI","date":"2020-05-31"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81054"},"country":"SE","date":"2020-05-31"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81055"},"country":"SE","date":"2020-06-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81056"},"country":"FI","date":"2020-06-07"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81057"},"country":"FI","date":"2020-06-20"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81058"},"country":"SE","date":"2020-06-20"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81059"},"country":"FI","date":"2020-07-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8105a"},"country":"FI","date":"2020-10-04"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8105b"},"country":"FI","date":"2020-10-31"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8105c"},"country":"SE","date":"2020-10-31"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8105d"},"country":"FI","date":"2020-11-08"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8105e"},"country":"FI","date":"2020-11-22"}
{"_id":{"$oid":"526fb09bf27d64a2a5e8105f"},"country":"FI","date":"2020-12-06"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81060"},"country":"FI","date":"2020-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81061"},"country":"SE","date":"2020-12-25"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81062"},"country":"FI","date":"2020-12-26"}
{"_id":{"$oid":"526fb09bf27d64a2a5e81063"},"country":"SE","date":"2020-12-26"}
{"_id":{"$oid":"527a1e45f27d9939c58df136"},"country":"FI","date":"2010-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df137"},"country":"FI","date":"2010-06-25"}
{"_id":{"$oid":"527a1e45f27d9939c58df138"},"country":"SE","date":"2010-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df139"},"country":"SE","date":"2010-06-25"}
{"_id":{"$oid":"527a1e45f27d9939c58df13a"},"country":"FI","date":"2011-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df13b"},"country":"FI","date":"2011-06-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df13c"},"country":"SE","date":"2011-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df13d"},"country":"SE","date":"2011-06-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df13e"},"country":"FI","date":"2012-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df13f"},"country":"FI","date":"2012-06-22"}
{"_id":{"$oid":"527a1e45f27d9939c58df140"},"country":"SE","date":"2012-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df141"},"country":"SE","date":"2012-06-22"}
{"_id":{"$oid":"527a1e45f27d9939c58df142"},"country":"FI","date":"2013-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df143"},"country":"FI","date":"2013-06-21"}
{"_id":{"$oid":"527a1e45f27d9939c58df144"},"country":"SE","date":"2013-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df145"},"country":"SE","date":"2013-06-21"}
{"_id":{"$oid":"527a1e45f27d9939c58df146"},"country":"FI","date":"2014-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df147"},"country":"FI","date":"2014-06-20"}
{"_id":{"$oid":"527a1e45f27d9939c58df148"},"country":"SE","date":"2014-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df149"},"country":"SE","date":"2014-06-20"}
{"_id":{"$oid":"527a1e45f27d9939c58df14a"},"country":"FI","date":"2015-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df14b"},"country":"FI","date":"2015-06-19"}
{"_id":{"$oid":"527a1e45f27d9939c58df14c"},"country":"SE","date":"2015-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df14d"},"country":"SE","date":"2015-06-19"}
{"_id":{"$oid":"527a1e45f27d9939c58df14e"},"country":"FI","date":"2016-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df14f"},"country":"FI","date":"2016-06-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df150"},"country":"SE","date":"2016-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df151"},"country":"SE","date":"2016-06-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df152"},"country":"FI","date":"2017-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df153"},"country":"FI","date":"2017-06-23"}
{"_id":{"$oid":"527a1e45f27d9939c58df154"},"country":"SE","date":"2017-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df155"},"country":"SE","date":"2017-06-23"}
{"_id":{"$oid":"527a1e45f27d9939c58df156"},"country":"FI","date":"2018-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df157"},"country":"FI","date":"2018-06-22"}
{"_id":{"$oid":"527a1e45f27d9939c58df158"},"country":"SE","date":"2018-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df159"},"country":"SE","date":"2018-06-22"}
{"_id":{"$oid":"527a1e45f27d9939c58df15a"},"country":"FI","date":"2019-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df15b"},"country":"FI","date":"2019-06-21"}
{"_id":{"$oid":"527a1e45f27d9939c58df15c"},"country":"SE","date":"2019-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df15d"},"country":"SE","date":"2019-06-21"}
{"_id":{"$oid":"527a1e45f27d9939c58df15e"},"country":"FI","date":"2020-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df15f"},"country":"FI","date":"2020-06-19"}
{"_id":{"$oid":"527a1e45f27d9939c58df160"},"country":"SE","date":"2020-12-24"}
{"_id":{"$oid":"527a1e45f27d9939c58df161"},"country":"SE","date":"2020-06-19"}
{"_id":{"$oid":"52cbbd27f27d4de388083899"},"country":"SE","date":"2010-12-31"}
{"_id":{"$oid":"52cbbd27f27d4de38808389a"},"country":"SE","date":"2011-12-31"}
{"_id":{"$oid":"52cbbd27f27d4de38808389b"},"country":"SE","date":"2012-12-31"}
{"_id":{"$oid":"52cbbd27f27d4de38808389c"},"country":"SE","date":"2013-12-31"}
{"_id":{"$oid":"52cbbd27f27d4de38808389d"},"country":"SE","date":"2014-12-31"}
{"_id":{"$oid":"52cbbd27f27d4de38808389e"},"country":"SE","date":"2015-12-31"}
{"_id":{"$oid":"52cbbd27f27d4de38808389f"},"country":"SE","date":"2016-12-31"}
{"_id":{"$oid":"52cbbd27f27d4de3880838a0"},"country":"SE","date":"2017-12-31"}
{"_id":{"$oid":"52cbbd27f27d4de3880838a1"},"country":"SE","date":"2018-12-31"}
{"_id":{"$oid":"52cbbd27f27d4de3880838a2"},"country":"SE","date":"2019-12-31"}
{"_id":{"$oid":"52cbbd27f27d4de3880838a3"},"country":"SE","date":"2020-12-31"}
#!/usr/bin/env ruby
require 'objspace'
ObjectSpace.trace_object_allocations_start
require 'mongo'
Mongo::Logger.logger.level = ::Logger::INFO # To avoid flooding STDERR with logs
@start_date = '2012-01-01'
@end_date = '2017-12-31'
@country = 'SE'
def find_holidays(db)
db[:holidays].find('country' => @country,
'date' => {
'$gte' => @start_date.to_s,
'$lte' => @end_date.to_s
}
).map { |h| h['date'] }
end
def mongo
client = get_connection
yield client
client.close
end
def get_connection
mongo_uri = 'mongodb://localhost/time'
options = {}
Mongo::Client.new(mongo_uri, options)
end
1000.times {
mongo { |db|
find_holidays(db)
}
}
GC.start
file = File.open('/tmp/dump.json', 'w')
ObjectSpace.dump_all(output: file)
file.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment