-
Notifications
You must be signed in to change notification settings - Fork 103
Open
Description
I have a piece of code that works with pymongo and my cosmos DB uri:
from pymongo import MongoClient
mongodb_uri = 'mongodb://....'
client = MongoClient(mongodb_uri)
db = client.foo
collection = db.test
doc = collection.find_one()
print(doc)
However when I try the same with txmongo:
from txmongo.connection import ConnectionPool
from twisted.internet import defer, reactor
@defer.inlineCallbacks
def example():
mongodb_uri = "mongodb://..."
client = ConnectionPool(mongodb_uri)
db = client.foo
test = db.test
doc = yield test.find_one()
print(doc)
if __name__ == '__main__':
example().addCallback(lambda ign: reactor.stop())
reactor.run()
If the uri is mongodb://localhost:27017
all good but with the cosmos db uri it doesn't work and I get an error message: TxMongo: run time of 1.0s exceeded.
(Edit: removed the useless yield
of the ConnectionPool
call)
Metadata
Metadata
Assignees
Labels
No labels