Mongodb – Restoring from MongoDB Atlas (4.2.5) to DocumentDB (3.6) do no succeed due to error “Unsupported BSON : type Decimal128”


MongoDB Atlas (4.2.5) to DocumentDB (3.6)

Below is the command I used for mongodump on my MongoDB shell. I had received a warning, but it was successfully completed.

C:\MongoDB\bin>mongodump --host,, --ssl --username Mdocdb --password xxxxx --authenticationDatabase admin --db sample_airbnb
2020-04-14T03:18:49.832+0530    WARNING: ignoring unsupported URI parameter 'replicaset'
2020-04-14T03:18:53.429+0530    writing sample_airbnb.listingsAndReviews to
2020-04-14T03:18:55.832+0530    [........................]  sample_airbnb.listingsAndReviews  0/5555  (0.0%)
2020-04-14T03:18:58.832+0530    [........................]  sample_airbnb.listingsAndReviews  0/5555  (0.0%)
2020-04-14T03:26:34.177+0530    [########################]  sample_airbnb.listingsAndReviews  5555/5555  (100.0%)
2020-04-14T03:26:34.204+0530    done dumping sample_airbnb.listingsAndReviews (5555 documents)

On AWS Ec2 instance, i issue the below command to restore the database, but it errors out.

[ec2-user@xxxxx sample_airbnb]$ ls -lrt
total 92156
-rw-rw-r-- 1 ec2-user ec2-user      738 Apr 13 21:48 listingsAndReviews.metadata.json
-rw-rw-r-- 1 ec2-user ec2-user 94362191 Apr 13 21:56 listingsAndReviews.bson

[ec2-xxx@xxxxxx ~]$ mongorestore --db airbnb sample_airbnb/ --ssl --host --sslCAFile rdsxxxxbundle.pem --username systemuser --password xxxxxx
2020-04-14T07:41:42.330+0000    checking for collection data in sample_airbnb/listingsAndReviews.bson
2020-04-14T07:41:42.333+0000    reading metadata for airbnb.listingsAndReviews from sample_airbnb/listingsAndReviews.metadata.json
2020-04-14T07:41:42.333+0000    restoring airbnb.listingsAndReviews from sample_airbnb/listingsAndReviews.bson
2020-04-14T07:41:42.771+0000    error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.100+0000    error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.195+0000    error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.257+0000    error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.261+0000    error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.355+0000    error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.356+0000    error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.426+0000    error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.467+0000    error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.469+0000    error: Unsupported BSON : type Decimal128
2020-04-14T07:41:43.469+0000    restoring indexes for collection airbnb.listingsAndReviews from metadata
2020-04-14T07:41:43.470+0000    Failed: airbnb.listingsAndReviews: error creating indexes for airbnb.listingsAndReviews: createIndex error: Field '2dsphereIndexVersion' is currently not supported

Since the index was failing, i avoided the index restore using the --noIndexRestore key.
The restore completed, although the previous Decimal error remained.

2020-04-14T07:42:01.284+0000    error: Unsupported BSON : type Decimal128
2020-04-14T07:42:01.284+0000    no indexes to restore
2020-04-14T07:42:01.284+0000    finished restoring airbnb.listingsAndReviews (5555 documents)
2020-04-14T07:42:01.284+0000    done

However, there was no data under the collection of the restored database. What could be wrong?

PS: I was able to import successfully to my local machine MongoDB (4.2.5) successfully. So this got to be something to do with the version compatibility?

on my local db:-

C:\MongoDB\bin>mongorestore --db sample_airbnb dump\sample_airbnb\listingsAndReviews.bson
2020-04-14T13:08:42.003+0530    checking for collection data in dump\sample_airbnb\listingsAndReviews.bson
2020-04-14T13:08:42.006+0530    reading metadata for sample_airbnb.listingsAndReviews from dump\sample_airbnb\listingsAndReviews.metadata.json
2020-04-14T13:08:42.066+0530    restoring sample_airbnb.listingsAndReviews from dump\sample_airbnb\listingsAndReviews.bson
2020-04-14T13:08:43.057+0530    restoring indexes for collection sample_airbnb.listingsAndReviews from metadata
2020-04-14T13:08:43.451+0530    finished restoring sample_airbnb.listingsAndReviews (2874 documents, 0 failures)
2020-04-14T13:08:43.451+0530    2874 document(s) restored successfully. 0 document(s) failed to restore.

Best Answer

According to the following comparison chart, MongoDB Atlas and Amazon DocumentDB are not fully compatible:

|                Item                |                                      DocuemntDB                                       |  MongoDB Atlas   |
| Fully compatible with MongoDB      | No, fails 63% of correctness testsImitation API. Does not run MongoDB under the hood. | Yes              |
| Support for latest MongoDB version | No. Feature set resembles MongoDB 2.6, released in 2014.                              | Yes. MongoDB 4.2 |
| ...                                | ...                                                                                   | ...              |

Reference: Comparing Amazon DocumentDB and MongoDB

I think the main issue is that you are trying to import a 4.2 version MongoDB into a 2.6 version of MongoDB.