Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit e4f548173946b6f7f4ac432665638b861e524547 1 parent 7e31380
@gcv authored
View
2  src/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))
View
9 test/test/appengine_magic/services/datastore.clj
@@ -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)))))
Please sign in to comment.
Something went wrong with that request. Please try again.