0

I'm working with MongoDB and want to analyze the extracted data from this database by python to visualize required information.Two question arises: 1) in such data there is DBRef that I don't know how to manipulate it, 2) it seems that is a nested data and needs to be broken to lowe level! 3) can I covert DBref to JSON file and the analyze it?

Thanks guys

1 Answers1

0

Have a look at this.

This allows you to essentially "unpack" the DBRef and retrieve only the id's, if that is of any use to you.

Example:

x = {
    "oId": 567,
    "notice": [
        DBRef("noticeId", ObjectId("5f45177b93d7b757bcbd2d55"))
    ]
}
print(x.get('oId'), d.get('notice')[0].id)
jcoke
  • 1,555
  • 1
  • 13
  • 27