0
I was connecting the Python to mongoDB cluster.
But I got the error message 'importError: cannot import name 'MutableMapping' from 'collections' in Python. I want to know how to solve this problem.

Here is my code

from pymongo import MongoClient
client = MongoClient('mongodb+srv://sparta:test@cluster0.59qgozp.mongodb.net/?retryWrites=true&w=majority')
db = client.PYTHON

doc = {
'name':'Kevin',
'age':24

} db.user.insert_many(doc)

I tried to change db.user.insert_one to db.user.insert_many but both of them didn't work. And I also tried to use Python 3.8.6 since I am using the 3.11.4.

camilla
  • 21
  • 1

1 Answers1

-1

I see this has been on SO before, you could read more here. Maybe it might help you cannot import name 'MutableMapping' from 'collections'

aspen l
  • 54
  • 7
  • Why was this down voted when SO gave the same answer after me?: `This question already has answers here: ImportError: cannot import name 'MutableMapping' from 'collections' (3 answers) Closed 22 hours ago.` I did the same as SO and before SO. Did I not help? Or provide a useful answer as per guidelines to SO? – aspen l Jul 17 '23 at 10:37