AzureCosmosDB / data-migration-desktop-tool

MIT License
108 stars 39 forks source link

mapping cosmos-nosql id to mongodb _id #104

Open Snamnik opened 5 months ago

Snamnik commented 5 months ago

I'm going to migrate my data from cosmos-nosql to mongodb . the tool doesn't map the cosmos id field to mongodb _id field. for example: cosmos data:

 {  "id": "BSKT_1",
    "CustomerId": 111,
}

the mapped data in mongo

{
"_id": ObjectId("659f9bbcb128ee4f195bdf8d"),
"id" : "BSKT_1",
"CustomerId": 111
}

how can I resolve this issue?

Snamnik commented 5 months ago

have found the issue. it's due to a section of the code in MongoDataSinkExtension Class, BuildDynamicObjectTree() where 'id' will be added rather than '_id' for MongoDB sink.

I see BuildDynamicObjectTree() is a general behavior which has been using in many places of the repo. but can we handle this issue for MongoDB as a configuration, just before adding the object to the Bson Document?

if you agree with the above suggestion, then I can make a PR to apply this logic. @bowencode @codingbandit

4