lib/mongo/collection/view/readable.rb in mongo-2.14.0.rc1 vs lib/mongo/collection/view/readable.rb in mongo-2.14.0

- old
+ new

@@ -224,9 +224,13 @@ # # @return [ Integer ] The document count. # # @since 2.6.0 def estimated_document_count(opts = {}) + unless view.filter.empty? + raise ArgumentError, "Cannot call estimated_document_count when querying with a filter" + end + cmd = { count: collection.name } cmd[:maxTimeMS] = opts[:max_time_ms] if opts[:max_time_ms] if read_concern cmd[:readConcern] = Options::Mapper.transform_values_to_strings( read_concern)