alisaifee / limits

Rate limiting using various strategies and storage backends such as redis & memcached
https://limits.readthedocs.org
MIT License
428 stars 58 forks source link

MongoDB storage: choose the `counters` and `limits` collection names #235

Open em-synth opened 2 months ago

em-synth commented 2 months ago

Expected Behaviour

For the MongoDB storage the collection names are fixed and can't be overwritten. I would like to use an existing database that has collections with same/similar names. I would prefer to choose a less generic naming for those collections. Would you be OK to have this change introduced? I would open a PR for that.

https://github.com/alisaifee/limits/blob/7b87c4d37659ae5fe0a8bf7216bfff789facd5f3/limits/storage/mongodb.py#L75-L81

Thanks.

alisaifee commented 20 hours ago

@em-synth: Sorry for the long delay in getting to this. Could you take a look at https://github.com/alisaifee/limits/commit/8b8236c59f29376aa43f3fc09aa98d4040a544e4 and see if that works for you?

em-synth commented 14 hours ago

Perfect, and neat implementation btw. Thank you!