irb(main):008:0> client[:artists].find(:name => 'Flying Lotus').estimated_document_count D, [2020-08-06T15:25:40.519452 #5734] DEBUG -- : MONGODB | localhost:14420 req:19 conn:1:1 sconn:2937 | admin.count | STARTED | {"count"=>"artists", "$db"=>"admin", "$clusterTime"=>{"clusterTime"=>#<BSON::Timestamp:0x0000561c640ade40 @seconds=1596741915, @increment=1>, "signature"=>{"hash"=><BSON::Binary:0x1140 type=generic data=0x0000000000000000...>, "keyId"=>0}}, "lsid"=>{"... D, [2020-08-06T15:25:40.520336 #5734] DEBUG -- : MONGODB | localhost:14420 req:19 | admin.count | SUCCEEDED | 0.001s => 3
When estimated_document_count is invoked on a view with conditions, it should raise an exception.
Note that currently it appears that the conditions are completely dropped and estimated_document_count effectively returns the wrong value:
irb(main):009:0> client[:artists].find(:name => 'Flying Lotus').count D, [2020-08-06T15:27:23.089681 #5734] DEBUG -- : MONGODB | localhost:14420 req:20 conn:1:1 sconn:2937 | admin.count | STARTED | {"count"=>"artists", "query"=>{"name"=>"Flying Lotus"}, "$db"=>"admin", "$clusterTime"=>{"clusterTime"=>#<BSON::Timestamp:0x00007fa258024ca0 @seconds=1596741933, @increment=1>, "signature"=>{"hash"=><BSON::Binary:0x3240 type=generic data=0x00000000000... D, [2020-08-06T15:27:23.090744 #5734] DEBUG -- : MONGODB | localhost:14420 req:20 | admin.count | SUCCEEDED | 0.001s => 0