0
我有一個MongoDB數據庫託管在mlab上,我想用PyMODM作爲我的對象建模庫。Pymodm連接到一個mlab MongoDB
這是我到目前爲止的代碼:
from pymodm import connect, MongoModel, fields
connect = connect('mongodb://user:[email protected]/db')
class Test(MongoModel):
user = fields.CharField()
if __name__ == "__main__":
test = Test("test")
test.save()
但它給我這個錯誤:
pymongo.errors.ServerSelectionTimeoutError: ds119788.mlab.com:27017: [Errno 61] Connection refused
我缺少的東西?
你試過嗎? http://pymodm.readthedocs.io/en/stable/getting-started.html#connecting-to-mongodb – Veeram
編輯我的問題@Veeram – essramos