Convert bson to json failed: type ‘bson.Symbol’ not supported

I have some bson files and use bsondump to convert them into json files. But I met some errors in the converting phase. Is that the bson files broke? Can someone tell me how to solve this problem?

2020-12-24T03:10:29.233+0000 714 objects found 2020-12-24T03:18:36.103+0000 488211 objects found 2020-12-24T03:20:40.273+0000 532560 objects found 2020-12-24T03:20:40.284+0000 0 objects found 2020-12-24T03:20:40.310+0000 0 objects found 2020-12-24T03:20:42.882+0000 14688 objects found 2020-12-24T03:20:42.898+0000 unable to dump document 1: error converting BSON to extended JSON: conversion of BSON value 'failed' of type 'bson.Symbol' not supported 2020-12-24T03:20:42.898+0000 0 objects found 2020-12-24T03:20:42.898+0000 error converting BSON to extended JSON: conversion of BSON value 'failed' of type 'bson.Symbol' not supported 2020-12-24T03:20:45.972+0000 33180 objects found 2020-12-24T03:20:48.615+0000 32150 objects found 2020-12-24T03:20:52.841+0000 25550 objects found 2020-12-24T03:20:52.854+0000 22 objects found 2020-12-24T03:20:55.092+0000 13946 objects found 2020-12-24T03:21:19.045+0000 22996 objects found 2020-12-24T03:21:19.075+0000 0 objects found 2020-12-24T03:21:22.594+0000 153814 objects found 2020-12-24T03:21:40.923+0000 42233 objects found 2020-12-24T03:21:40.943+0000 312 objects found 2020-12-24T03:21:41.331+0000 5912 objects found 2020-12-24T03:21:43.303+0000 43433 objects found

Welcome to the MongoDB forum @Icarus_Wu!

The BSON Symbol type has been deprecated since 2011, so you may have trouble finding support in recent versions of tools and drivers.

Can you confirm your O/S version and the output of bsondump --version?

Do you know what tool or driver is creating the BSON files?


@Stennie_X Hello Sir!
My boss gave me some bson files but not sure where them from…
And I just use my ubuntu machine ‘apt install mongo-tools’ to install the mongo-tools. Sorry that I haven’t touched the mongodb ever before, so I’m unfamiliar with mongodb. I checked the bsondump version and get this
bsondump version: built-without-version-string git version: built-without-git-spec Go version: go1.10.1 os: linux arch: amd64 compiler: gc OpenSSL version: OpenSSL 1.1.0g 2 Nov 2017
I just wanna check one thing. Will I get the converted json files if I failed in the converting phase? In other words, will mongo tools ignore the converting errors and return me a json file from a bson file?
Thank u sir.

Hi @Icarus_Wu,

I expect bsondump would skip any documents that cannot be fully decoded rather than doing an incomplete conversion. For more control over the conversion, I would look into BSON support using one of the officially supported drivers.

Would you be able to share a small BSON test file without including any confidential data?

I would also ask your boss for more information on the origin of the files, as perhaps the tool/driver that is creating these files might provide a hint at how to read them.