#2247 changed the default MongoDB count timeout to 0.5 seconds, which means it will usually fail quickly for any sizable query. This has limited utility in the case where the user actually just wants to know the number of results without pagination. I suggest a hybrid strategy where the MongoDB timeout is allowed to be quite large for the first page of results, but then is very small for all subsequent pages. This should make pagination significantly faster, and savvy clients can just cache the value of the number of results from the first response they get.
#2247 changed the default MongoDB count timeout to 0.5 seconds, which means it will usually fail quickly for any sizable query. This has limited utility in the case where the user actually just wants to know the number of results without pagination. I suggest a hybrid strategy where the MongoDB timeout is allowed to be quite large for the first page of results, but then is very small for all subsequent pages. This should make pagination significantly faster, and savvy clients can just cache the value of the number of results from the first response they get.