Ticket #294 (closed defect: fixed)
#:limit values other than 1 return the whole collection in mongo-collection-find
| Reported by: | joe@… | Owned by: | jaymccarthy |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | jaymccarthy/mongodb.plt | Keywords: | |
| Cc: | Version: | (1 5) | |
| Racket Version: | 5.0 |
Description
Code describes the problem better than I can (or do let me know if I'm missing something):
(require (planet "main.rkt" ("jaymccarthy" "mongodb.plt" 1 5)))
(define m (create-mongo))
(define d (make-mongo-db m "TEST"))
(current-mongo-db d)
(define-mongo-struct link "links"
([url #:required]))
(mongo-db-drop-collection! d "links")
(define l1 (make-link #:url "www.google.com"))
(define l2 (make-link #:url "www.foozle.com"))
(define l3 (make-link #:url "www.bing.com"))
(define l4 (make-link #:url "www.bing2.com"))
(length (for/list ((l (mongo-collection-find (make-mongo-collection d "links") #hasheq() #:limit 1))) l))
;; returns 1
(length (for/list ((l (mongo-collection-find (make-mongo-collection d "links") #hasheq() #:limit 2))) l))
;; returns 4
(length (for/list ((l (mongo-collection-find (make-mongo-collection d "links") #hasheq() #:limit 3))) l))
;; returns 4
(length (for/list ((l (mongo-collection-find (make-mongo-collection d "links") #hasheq() #:limit 4))) l))
;; returns 4
Change History
Note: See
TracTickets for help on using
tickets.
