Comments (2)
See #63
It seems that the connection is working and the pytest tests are passing using the format explained in the documentation, however, it is not working with the Makefile.
I added the template in the test code to make sure the template format is agreed.
mongo_uri_template = "mongodb+srv://<user>:<password>@<db_uri>/"
While I defined
MONGODB_DATABASE=fsdl-dev
MONGODB_COLLECTION=ask-fsdl
MONGODB_DB_URI=fsdl.chjrrhb.mongodb.net
MONGODB_USER=myuser
MONGODB_PASSWORD=mypass
I don't understand where is the code that formats the env variables for the connection
e.g. the code that replaces the test code that does the connection functionality like this
@pytest.fixture(scope="module")
def mongodb_connection():
dotenv_path = os.path.join(os.path.dirname(__file__), "..", ".env")
load_dotenv(dotenv_path)
db_name = os.environ.get("MONGODB_DATABASE")
collection_name = os.environ.get("MONGODB_COLLECTION")
mongo_user = os.environ.get("MONGODB_USER")
mongo_password = os.environ.get("MONGODB_PASSWORD")
mongo_uri = os.environ.get("MONGODB_DB_URI")
mongo_uri_template = "mongodb+srv://<user>:<password>@<db_uri>/"
# Replace placeholders with actual values
mongo_uri = (
mongo_uri_template.replace("<user>", mongo_user)
.replace("<password>", mongo_password)
.replace("<db_uri>", mongo_uri)
)
client = pymongo.MongoClient(mongo_uri)
db = client[db_name]
collection = db[collection_name]
yield collection
from ask-fsdl.
Will add different clean PR
from ask-fsdl.
Related Issues (20)
- add in more videos
- improve transcript quality
- automate ingestion of emoji feedback
- abstract LLM choice, make it configurable HOT 1
- run the Discord bot in Modal HOT 1
- add a Mermaid diagram of the architecture to the README
- deliver a better devX
- update the setup instructions
- add QoL tooling for ad hoc work with JSON, e.g. `jq` HOT 2
- use a text index with a prefix regex to demonstrate the principle of indices
- make document-store error: pymongo.errors.InvalidURI HOT 5
- resolve flakiness of the yt.lemnoslife endpoint
- consider rearchitecting in light of new pricing and features from OpenAI
- try out PaLM
- make document-store error: UnicodeEncodeError: 'utf-8' codec can't encode characters in position 16-18: surrogates not allowed HOT 2
- use Modal environments to separate dev and prod
- resolve occasional timeouts
- pymongo.errors.InvalidURI: Bad database name
- Getting modal.exception.DeprecationError: Deprecated on 2023-08-16: Calling Modal functions like f(...) is deprecated HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ask-fsdl.