summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Cook <jordan.cook@pioneer.com>2022-04-12 19:05:40 -0500
committerJordan Cook <jordan.cook@pioneer.com>2022-04-15 18:20:47 -0500
commit341303f78d95f44ed52208e7d90e05b49afea1cb (patch)
treee318df4bfda34a2bdcc1e7ff3bca35e596c8448b
parentf72454497ce73f99aef2bbdeeb5b1711452b12fe (diff)
downloadrequests-cache-341303f78d95f44ed52208e7d90e05b49afea1cb.tar.gz
Add notes on viewing responses in MongoDB
-rw-r--r--docs/_static/mongodb_vscode.pngbin0 -> 216933 bytes
-rw-r--r--requests_cache/backends/mongodb.py21
2 files changed, 19 insertions, 2 deletions
diff --git a/docs/_static/mongodb_vscode.png b/docs/_static/mongodb_vscode.png
new file mode 100644
index 0000000..cccc18d
--- /dev/null
+++ b/docs/_static/mongodb_vscode.png
Binary files differ
diff --git a/requests_cache/backends/mongodb.py b/requests_cache/backends/mongodb.py
index 2e4bf5a..59b5c52 100644
--- a/requests_cache/backends/mongodb.py
+++ b/requests_cache/backends/mongodb.py
@@ -10,7 +10,25 @@ Use Cases
^^^^^^^^^
MongoDB scales well and is a good option for larger applications. For raw caching performance,
it is not quite as fast as :py:mod:`~requests_cache.backends.redis`, but may be preferable if you
-already have a MongoDB instance you're using for other purposes, or if you find it easier to use.
+already have an instance running, or if it has a specific feature you want to use. See below for
+some relevant examples.
+
+Viewing Responses
+^^^^^^^^^^^^^^^^^
+Unlike most of the other backends, response data can be easily viewed via the
+`MongoDB shell <https://www.mongodb.com/docs/mongodb-shell/#mongodb-binary-bin.mongosh>`_,
+`Compass <https://www.mongodb.com/products/compass>`_, or any other interface for MongoDB. This is
+possible because its internal document format (`BSON <https://www.mongodb.com/json-and-bson>`_)
+supports all the types needed to store a response as a plain document rather than a fully serialized
+blob.
+
+Here is an example response viewed in
+`MongoDB for VSCode <https://code.visualstudio.com/docs/azure/mongodb>`_:
+
+.. admonition:: Screenshot
+ :class: toggle
+
+ .. image:: ../_static/mongodb_vscode.png
Expiration
^^^^^^^^^^
@@ -95,7 +113,6 @@ logger = getLogger(__name__)
# TODO: TTL tests
-# TODO: Example of viewing responses with MongoDB VSCode plugin or other GUI
# TODO: Is there any reason to support custom serializers here?
# TODO: Save items with different cache keys to avoid conflicts with old serialization format?
# TODO: Set TTL for redirects? Or just clean up with remove_invalid_redirects()?