Home > Software design >  AttributeError: 'dict' object has no attribute 'distinct'
AttributeError: 'dict' object has no attribute 'distinct'

Time:10-31

I have a bson file, and i dont know what have inside of the file. So, a read the file. And now, i still trying to found the value of each key, but not is easy. Because, i receive the messange:

AttributeError: 'dict' object has no attribute 'distinct'

What i do?

enter image description here

Am I writing more code? What am I doing wrong?

CodePudding user response:

When I do understand your question, read_content['_id'] should suffice.

So the code should be:

read_content = bson.json_util.loads(content)
print(read_content['_id'])
  • Related