How to export mongodb without any wrapping using NumberInt (...)?

I want to export mongodb as json, here is the entry:

{"_id":{"$oid":"554f042c0e81bf483e4a4e2f"}, "batch":"3","bz":NumberInt(1)}

Having problems when I use json to load:

json.loads('{"_id":{"$oid":"554f042c0e81bf483e4a4e2f"}, "batch":"3","bz":NumberInt(1)}')

he returns ValueError: No JSON object could be decoded. This is due to the fact that jsonit cannot deal with NumberInt(1).

So how can I translate NumberInt(1)in 1upon export?

+4
source share
1 answer

[UPDATE] If your mongo collection does not include NumberInt, and mongoexport creates a json document that includes NumberInt, this is an error. I leave my answer if someone has the same problem as mine.

It seems to have been a mistake

https://jira.mongodb.org/browse/TOOLS-741 https://jira.mongodb.org/browse/TOOLS-681, 3.1.4

3.1.6 ( dev),

0

All Articles