Thank you @kanikasingla. I have the following code in movie_last_updated_migration.py file
# ensure you update your host information below!
#host = "mongodb://localhost:27017"
host = "mongodb+srv://m220student:m220password@sandbox-axxxk.mongodb.net/test"
# don't update this information
MFLIX_DB_NAME = "sample_mflix"
mflix = MongoClient(host)[MFLIX_DB_NAME]
after executing the file , I am getting the following message, so I’m sure that connecting to Atlas is ok.
23539 documents to migrate
It is failing at buk_write command. I put one print statement just before that to verify, and it is printing the message.
len1=bulk_updates.__len__()
print("before bulk result",len1)
# here's where the bulk operation is sent to MongoDB
bulk_results = mflix.movies.bulk_write(bulk_updates)
print(f"{bulk_results.modified_count} documents updated")
(venv) D:\MongoDB\m220\mflix-python\migrations>python movie_last_updated_migration.py
23539 documents to migrate
before bulk result 23539
sandbox-shard-00-01-axxxxk.mongodb.net:27017: [WinError 10054] An existing connection was forcibly closed by the remote host