So I'm trying to save my block into mongodb but I'm getting this error I've already tried all the answers on google/stackoverflow/some other sites but I'm not getting the same results as everyone else. Am I missing something?
import json
from bson import json_util
client = pymongo.MongoClient("****")
blockData = json.dumps(p1.get_latest_block().__dict__, default=json_util.default)
print(blockData)
db = client.blockchain
block = db.blocks
block.insert_one(blockData)
This is the block data
{
"_id":1,
"index_no":1,
"data":"John",
"timestamp":{
"$date":1593037993478
},
"previous_hash":0,
"hash":"090c384953d601ecda0d12f4cade9f2fb81029739b4642db900b75e56d7f55b6",
"nonce":37
}