Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

Unclear how to use external databases like MongoDB #10

Closed
pi314ever opened this issue Oct 26, 2023 · 1 comment
Closed

Unclear how to use external databases like MongoDB #10

pi314ever opened this issue Oct 26, 2023 · 1 comment

Comments

@pi314ever
Copy link

pi314ever commented Oct 26, 2023

I've been trying to figure out a way to utilize a MongoDB database as a long-term storage option that persists between runs of the application. The documentation provides very little information, and there are no examples of using MongoDB (or any other of the external stores) to retrieve/save information.

Is this functionality implemented yet? If so, can you expand on the documentation to provide examples of interfacing with the database?

Specifically, I want to save a lot of match information with something that looks like

summoner = await Summoner(...)
matches = await MatchHistory(puuid=summoner.puuid).query(count=10).get()
mongodb = ... # How do I access the database specified in the config?
for id in matches.ids:
    match = await Match(id=id).get()
    # Save the match to MongoDB
    mongodb.set( ... )
@iann838
Copy link
Owner

iann838 commented Oct 27, 2023

@pi314ever The implementation of MongoDB in Pyot is completely internally managed cache store, if a MongoDB is configured in the pipeline, Pyot will look for data in each of the stores in a sequential manner, so if MongoDB is before RiotAPI, then it will first look into MongoDB, if the data exists then return it, if it does not exists, proceed to the next store, at some point it will require to pull data from the source RiotAPI, this data is then replicated across the previous stores for cache purposes. Although this cache store can used for long-term storage by configuring expiration to never, it was primarily designed to be a cache. Here are the configuration details you need to plug into the pipeline: https://pyot.iann838.com/stores/mongodb.
If you wish to have complete control over MongoDB, then please do not use the MongoDB cache store provided by Pyot, instead configure your own storage for your specific use case.

@iann838 iann838 closed this as completed Oct 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants