Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4203

exists? method can be slow

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      It seems that the criteria.exists? method uses count under the hood. Wouldn't this be better to use limit(1), so it doesn't need to count large collections?

      ```
      def exists?
      count > 0
      end
      ```

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            johnnyshields Johnny Shields
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: