 (defn element-at
   [label]
   {:$arrayElemAt [(dollar label) 0]})
+
+(defn sort-order
+  [direction]
+  (if (= "desc" (name direction)) -1 1))
+
+(defn sortBy
+  [field direction]
+  (let [order (sort-order direction)]
+    [{:$sort {(name field) order}}]))
 
 (declare translate)
 

   :order order
   :offset offset
   :count qount
   :groupCount group-count})

(defn apply-step

   :desc -1})

(defn qount
  []
  [{:$count "count"}])

(defn dedup
  []
