I’m commenting only to point out that the link to github doesn’t seem to work
@Alessio_Ruggi Thanks for the heads-up! I’ve just fixed it.
Hello @DeveloperCenter,
I followed these steps and the APIs were working fine until few months ago. Also, I have not used Motor and gone with pymongo[srv]. The mongo db is starting to throw connection timeout error intermittently. Following is my setup code:
def db_lifespan(app: FastAPI):
# Startup
server_api = ServerApi(‘1’)
app.mongodb_client = MongoClient(CONNECTION_STRING,
maxIdleTimeMS=600000,
maxConnecting=5,
timeoutMS=90000,
socketTimeoutMS=90000,
serverMonitoringMode=“poll”,
server_api=server_api)
app.database = app.mongodb_client.get_database(DB_NAME)
ping_response = app.database.command(“ping”)
if int(ping_response[“ok”]) != 1:
raise Exception(“Problem connecting to database cluster.”)
else:
logger.info(“Connected to database cluster.”)
yield
# Shutdown
app.mongodb_client.close()
Could anyone please help me out with the issue?
New & Unread Topics
Topic | Replies | Views | Activity |
---|---|---|---|
Spark Up Your MongoDB and BigQuery using BigQuery Spark Stored Procedures | 0 | 286 | May 2024 |
How to Use Cohere Embeddings and Rerank Modules with MongoDB Atlas | 0 | 380 | May 2024 |
MongoDB Atlas Vector Search and AWS Bedrock modules RAG tutorial | 0 | 438 | Jun 2024 |
Building AI and RAG Apps With MongoDB, Anyscale and PyMongo | 0 | 287 | Jul 2024 |
AI-Powered Playlist Generator: Crafting Custom Vibes With Deeplearning4j and MongoDB | 0 | 31 | Oct 2024 |