Issue on Lab: Inserting a Document in Python Applications

Hi there, it seems there is an issue on the files insert_single.py and insert_multiple.py at line 5 importing MongoClient from pymongo and according to the atlas connect configuration, it should import MongoClient from pymongo.mongo_client . After making this change, it allowed me to insert the records, they were verified on Atlas (browse collections) but at the lab it shows me error “The documents were not found in the database” so I had to skip the lab. Thanks in advance. Greetings.

Hi @David_Delgado ,

Thanks for bringing this to our attention.

Both ways of importing should work. The code used in the lab, from pymongo import MongoClient is supported and documented in the PyMongo documentation. I ran through the lab and was able to complete is successfully without changing the import.

1 Like

Hi Davenson,

Thanks for your answer, I tested again with the line from pymongo import MongoClient and worked fine. Then, the issue could be on line on line 9 defining the URI. I removed the os.environ() part to define the uri = “MONGODB_URI” directly instead of using os.environ(“MONGODB_URI”). Greetings,

1 Like

Hi again,
In addition, these labs refer to a ‘bank’ database but I was not able to find that dataset. Should we create that db by ourselves? It doesn´t seem to be part of the sample datasets. Is there a path to find it?
Thanks in advance.
Greetings,

Hi David,

The bank database is bundled in the lab and created for you when launching the lab. It doesn’t exist in the sample dataset.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.