Query DSL work preparation
This commit is contained in:
parent
6dd3491d39
commit
88fa9f07bb
1 changed files with 76 additions and 63 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
(set! *warn-on-reflection* true)
|
(set! *warn-on-reflection* true)
|
||||||
|
|
||||||
(ns monger.test.querying
|
(ns monger.test.querying
|
||||||
|
(:refer-clojure :exclude [select find])
|
||||||
(:import [com.mongodb WriteResult WriteConcern DBCursor DBObject CommandResult$CommandFailure]
|
(:import [com.mongodb WriteResult WriteConcern DBCursor DBObject CommandResult$CommandFailure]
|
||||||
[org.bson.types ObjectId]
|
[org.bson.types ObjectId]
|
||||||
[java.util Date])
|
[java.util Date])
|
||||||
|
|
@ -9,6 +10,7 @@
|
||||||
[monger.result :as mgres])
|
[monger.result :as mgres])
|
||||||
(:use [clojure.test]
|
(:use [clojure.test]
|
||||||
[monger.test.fixtures]
|
[monger.test.fixtures]
|
||||||
|
;; [monger.query]
|
||||||
[monger.conversion]))
|
[monger.conversion]))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -76,6 +78,17 @@
|
||||||
|
|
||||||
;; < ($lt), <= ($lte), > ($gt), >= ($gte)
|
;; < ($lt), <= ($lte), > ($gt), >= ($gte)
|
||||||
|
|
||||||
|
;; (deftest query-using-dsl-and-$lt-operator
|
||||||
|
;; (let [coll "docs"
|
||||||
|
;; doc1 { :language "Clojure" :_id (ObjectId.) :inception_year 2006 }
|
||||||
|
;; doc2 { :language "Java" :_id (ObjectId.) :inception_year 1992 }
|
||||||
|
;; doc3 { :language "Scala" :_id (ObjectId.) :inception_year 2003 }
|
||||||
|
;; _ (mgcol/insert-batch coll [doc1 doc2])
|
||||||
|
;; lt-result (in-collection "docs"
|
||||||
|
;; (find { :inception_year { "$lt" 2000 } })]
|
||||||
|
;; (is (= [doc2] lt-result))))
|
||||||
|
|
||||||
|
|
||||||
(deftest query-with-find-maps-using-$lt-operator
|
(deftest query-with-find-maps-using-$lt-operator
|
||||||
(let [coll "docs"
|
(let [coll "docs"
|
||||||
doc1 { :language "Clojure" :_id (ObjectId.) :inception_year 2006 }
|
doc1 { :language "Clojure" :_id (ObjectId.) :inception_year 2006 }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue