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

Mongoid::Criteria#tally should accept multiple field args as a splat

    • Type: Icon: Task Task
    • Resolution: Won't Do
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      Ticket MONGOID-5270 implements tally with a single field arg.

      I'd like to propose that tally support multiple field args (as a splat), then return the result as an Array<Hash>. This would allow us to fetch multiple tallies in a single aggregation pipeline pass, saving on time/db resources.

      Dog.tally(:color, :size)
        #=> [ { yellow: 9,
        #       brown: 7,
        #       white: 14 },
        #     { small: 10,
        #       medium: 9,
        #       large: 11 } ]
      

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            shields@tablecheck.com Johnny Shields
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: