        {:input dollar
         :as "index"
         :in
-        {:k "$$index._id"
-         :v "$$index.count"}}}
-      {:$arrayToObject dollar}]]))
+        {(keyword outer) "$$index._id"
+         :count "$$index.count"}}}
+      dollar]]))
 
 (defn render-percentile
   [outer percentiles]

            {:$divide
             [dollar interval]}}]}
         :count {:$sum 1}}}
       {:$sort {"_id" -1}}]
      dollar
      dollar]]))

(defn render-aggregate

(defn group-count
  [path]
  [{:$group {:_id (dollar path) :count {:$sum 1}}}
   {:$project {(name path) "$_id" :count "$count"}}])

(defn unwind
  [label]
