MongoDB Atlas Connection Issue

29 views
Skip to first unread message

Andy

unread,
Sep 25, 2020, 11:27:50 AM9/25/20
to MongoEngine Users
Hi there,

I am having some issues connecting to my database on MongoDB. I am using mongoengine library to connect to the DB. I am also using ATLAS. Whenever I try to run my project it keeps showing "Exception has occurred: ServerSelectionTimeoutError" then show [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate.  Does anyone have any recommendations?

My code: 

from enum import unique
from json import dumps
from mongoengine import *
from datetime import datetime
import json
import os

db_uri = "My link would go in here"

connect(host=db_uri)

class Artists(DynamicDocument):
    artistName = StringField()
    artistEarning = FloatField()
    artistAlbumn = IntField()
    dateAdded = DateTimeField(default=datetime.utcnow())

    def json(self):
        artist = {
            "Artist": self.artistName,
            "Artist Earnings": self.artistEarning,
            "Amount of Albums": self.artistAlbumn,
            "Info Added": self.dateAdded
        }
        return json.dumps(artist)

artists = Artists(
    artistName="Post Malone",
    artistEarning=20000.00,
    artistAlbumn=20
).save()

print('Data Saved')
Reply all
Reply to author
Forward
0 new messages