express-restify-mongoose
express-restify-mongoose copied to clipboard
Added the ability to set totalCountHeader on a specific request
The point of this is to be able to set totalCountHeader on specific requests. We have been dealing with larger collections where some of the queries count is not performant, and do not want it to run on.
I'll take a closer look as soon as possible, thanks for your contribution!
While this solution solves your issue on the surface, a malicious client could simply remove the query parameter, notice the difference in response time and then you're back to square one: vulnerable to DoS. I do like the idea but I think step one would be to add the ability to set the count header per endpoint and then expose a way to set it dynamically on the server, probably somewhere in pre
middleware.