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


(defn group-set
  [label]
  [{:$group {:_id "$_id" label {:$push (str "$" label ".gid")}}}])

(defn element-at
  [label]
  {:$arrayElemAt [(str "$" label) 0]})

(declare translate)



(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]
