diff options
author | Jordan Cook <jordan.cook.git@proton.me> | 2022-10-24 15:08:00 -0500 |
---|---|---|
committer | Jordan Cook <jordan.cook.git@proton.me> | 2023-03-01 17:36:27 -0600 |
commit | 6d69d5f81da7f7c0323dd858e534597a65a9053c (patch) | |
tree | 5ac4658941134d00eac0d99f3cb2980274ad6a06 /mongita_test.py | |
parent | 812301ab85a3b54387dcebd7d65407ace2589b9f (diff) | |
download | requests-cache-mongita.tar.gz |
WIP: Minor workaround in MongoDB backend to support mongitamongita
Diffstat (limited to 'mongita_test.py')
-rw-r--r-- | mongita_test.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/mongita_test.py b/mongita_test.py new file mode 100644 index 0000000..18a4864 --- /dev/null +++ b/mongita_test.py @@ -0,0 +1,24 @@ +from mongita import MongitaClientDisk +from pymongo import MongoClient + + +def test_ids(client): + collection = client['test_db']['test_collection'] + collection.replace_one( + {'_id': 'id_from_filter'}, + replacement={'key': 'value'}, + upsert=True, + ) + doc = collection.find_one({'_id': 'id_from_filter'}) + print(f'Fetched document by ID: {doc}') + + print('All IDs:') + for d in collection.find({}): + print(d['_id']) + + +print('pymongo\n----------') +test_ids(MongoClient()) + +print('\nmongita\n----------') +test_ids(MongitaClientDisk()) |