Created
December 7, 2012 05:26
-
-
Save ChristopherBiscardi/4231005 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(:require [monger.collection :as mc] | |
[monger.conversion :as convert]) | |
;; get distinct values from the posts collection for the field category. | |
(mc/distinct "posts" "category") | |
;; get distinct values from the posts collection for the field category with a query. | |
(mc/distinct "posts" "category" {:limit 5}) | |
;; convert values to maps using an anonymous function | |
(map | |
(fn [cat] (convert/from-db-object cat false)) | |
(mc/distinct "posts" "category")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment