'Block creation or usage of *specific* collections in Mongo
I have a python project with many calls from multiple places and services to a specific mongo collection - lets call it "cache_collection". I moved this collection to a different Mongo instance to reduce load from the major db, and plan to remove the collection in the older db.
The thing is this - I want to make sure it won't be possible to access "cache_collection" in the older db. meaning calling get_collection('cache_collection') will return an exception, or any attempt to read/write from this collection will raise an exception. Since mongo dynamically generates collections per demand, the desired behavior is not that easy to get.
I've read about Mongo access-control and This question but it's not ideal. because it seems like permissions are additive and not restrictive and I don't want to define the "basic" permission set as none and keep maintaining collection permissions for the rest of the project.
Is there a simple solution for this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
