Permalink
Browse files

Removed the 1000 entity limit from counting objects in the datastore.

  • Loading branch information...
1 parent 7e31380 commit e4f548173946b6f7f4ac432665638b861e524547 @gcv committed Sep 22, 2011
Showing with 10 additions and 1 deletion.
  1. +1 −1 src/appengine_magic/services/datastore.clj
  2. +9 −0 test/test/appengine_magic/services/datastore.clj
@@ -460,7 +460,7 @@
result-type (if (and (instance? Class kind) (extends? EntityProtocol kind))
kind
entity-record-type)
- result-count (.countEntities prepared-query)]
+ result-count (.countEntities prepared-query fetch-options-object)]
(cond count-only? result-count
(zero? result-count) (list)
:else (let [results (seq (.asIterable prepared-query fetch-options-object))
@@ -119,3 +119,12 @@
a2 (Author. "A2")]
(ds/save! [a1 a2])
(is (ds/query :kind Author :chunk-size 10 :prefetch-size 10))))
+
+
+(deftest count-many-objects
+ (let [max 1200
+ make-author (fn make-author [x]
+ (ds/save! (Author. (str "Author " x))))]
+ (dotimes [i max]
+ (make-author i))
+ (is (= max (ds/query :kind Author :count-only? true)))))

0 comments on commit e4f5481

Please sign in to comment.