MongoDB: Query has implicit limit(256)?

前端 未结 1 642
情歌与酒
情歌与酒 2021-01-22 23:13

I\'ve created (in code) a default collection in MongoDB and am querying it, and have discovered that while the code will return all the data when I run it locally, it won\'t whe

相关标签:
1条回答
  • 2021-01-22 23:36

    You need to specify a bigger batch-size, the default is 256 records.

    Here's an example from my own code:

    => (count (with-db (q/find {:keywords "lisa"}) 
                      (q/sort {:datetime 1}) ))
    256
    
    => (count (with-db (q/find {:keywords "lisa"}) 
                      (q/sort {:datetime 1}) 
                      (q/batch-size 1000) ))
    688
    

    See more info here: http://clojuremongodb.info/articles/querying.html#setting_batch_size

    0 讨论(0)
提交回复
热议问题