Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-2566

Prohibit skip and limit in estimated_document_count

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.15.0
    • Affects Version/s: None
    • Component/s: Query

      estimated_document_count prohibits find conditions:

      irb(main):008:0> a['foo'].find(a:1).estimated_document_count
      Traceback (most recent call last):
              5: from /home/w/.rbenv/versions/2.7/bin/irb:23:in `<main>'
              4: from /home/w/.rbenv/versions/2.7/bin/irb:23:in `load'
              3: from /home/w/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
              2: from (irb):8
              1: from /home/w/apps/ruby-driver/lib/mongo/collection/view/readable.rb:230:in `estimated_document_count'
      ArgumentError (Cannot call estimated_document_count when querying with a filter)
      

      However it does not prohibit skip and limit constraints:

      irb(main):009:0> a['foo'].find.skip(4).estimated_document_count
      => 10
      irb(main):010:0> a['foo'].find.limit(4).estimated_document_count
      => 10
      

            Assignee:
            dmitry.rybakov@mongodb.com Dmitry Rybakov
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: