My first instinct is "that's a lot of objects to be fetching in one HTTP request!".
I can't say exactly why this doesn't work but I suspect it's the collating into a Future[List[JsObject]]
that is killing the thing.
I would use the version of Cursor.toList()
that takes an upTo
parameter, set that to a reasonable number (say 100) and then allow the client to specify which page
of results they want to see as a parameter. You could even let the client set the page size if you trust them not to get too greedy.
Obviously you'll need to add another clause to your find
to get the correct offset for the pagination; if your client just tells you the highest _id
value that they've already got, your find()
query would still be very simple.