    [protograph.kafka :as kafka]
    [ophion.config :as config]
    [ophion.mongo :as mongo]))
+
+(defn dollar
+  [s]
+  (str "$" (name s)))
 
 (defn where
   [where]

  [{:$project
    (reduce
     (fn [project label]
       (assoc project label (str "$_history." label)))
     {} labels)}])

(defn limit


(defn dedup-on
  [field]
  (let [path (dollar field)]
    [{:$group {:_id path :dedup {:$first "$$ROOT"}}}
     {:$replaceRoot {:newRoot "$dedup"}}]))

    ;; {:$group {:_id dollar (keyword field) {:$first dollar} :_history {:$addToSet "$_history"}}}

(defn offset
  [n]
