mongoengine.connection.ConnectionFailure: You have not defined a default connection
Closed this issue · 8 comments
Excuse me, why do I keep reporting “mongoengine.connection.ConnectionFailure: You have not defined a default connection”errors?
What does your config look like?
Sorry I need to update the readme. This expects you to use mongoengine
to create a connection. Something like:
MONGO_DB = "telethon"
MONGO_URI = f"mongodb://localhost/{MONGO_DB}"
mongoengine.connect(MONGO_DB, host=MONGO_URI)
session = MongoSession(MONGO_DB, host=MONGO_URI)
client = TelegramClient(session, API_ID, API_HASH)
Sorry I need to update the readme. This expects you to use
mongoengine
to create a connection. Something like:MONGO_DB = "telethon" MONGO_URI = f"mongodb://localhost/{MONGO_DB}" mongoengine.connect(MONGO_DB, host=MONGO_URI) session = MongoSession(MONGO_DB, host=MONGO_URI) client = TelegramClient(session, API_ID, API_HASH)
Thank's it works, for future references need add : from mongoengine import connect
A limitation that I see is that there is no set for multiple sessions, all new login replace the current Session. On SQLALquemy version we set a session, so multiples sessions can be store in database.
I based it off the SQLite version, but I'd be happy for a PR if that's something you want to add
Sorry I need to update the readme. This expects you to use
mongoengine
to create a connection. Something like:MONGO_DB = "telethon" MONGO_URI = f"mongodb://localhost/{MONGO_DB}" mongoengine.connect(MONGO_DB, host=MONGO_URI) session = MongoSession(MONGO_DB, host=MONGO_URI) client = TelegramClient(session, API_ID, API_HASH)
Hi, it work, but not updated in readmy)
Thanks, for this library))
If anyone wants to PR I'd be happy to merge. Just been really busy and haven't been using this myself.
Fixed this in the README