Migration of data from azure cosmos db to on premise mongodb

Sri 0 Reputation points
2023-06-23T11:24:47.87+00:00

Hi ,

We are planning to migrated the data from azure cosmos nosql database to on premise mongodb .we have generated bson files for each container and tried to import to mongodb locally.

But can we convert the data from azure aligned to the mongodb here.

AzureCosmosdb data sample :

{
    "AccountId": "391048c0-4a7a-c48e-b9ad-1d3455aa6c8",
    "Discriminator": "AccountModel",
    "EmailAddress": "c2h1YmhheXUuZGsdSDSDxvZy5jb20=",
    "id": "AccountModel|391048c0-4a7a-c48e-b9ad-1d3453455aa6c8",
    "_rid": "XFY1AJTJb64BAAAAAAAAAA==",
    "_etag": "\u00222342df3-0000-0c00-0000-649315530000\u0022",
    "_attachments": "attachments/",
    "_ts": 16834360851
  },

We are looking for saving the above json data in mongodb like below with binary data format with base64 and subtype

[{
  "_id": {
    "$binary": {
      "base64": "xraIZIOoY5coI0A==",
      "subType": "03"
    }
  },
  "_t": "AccountEntity",
  "EmailAddress": "ZGFYUBhbmFsb2cuY29t",
  "AccountProjectsModels": null
}]
Azure Database Migration service
{count} votes

1 answer

Sort by: Most helpful
  1. ShaktiSingh-MSFT 14,281 Reputation points Microsoft Employee
    2023-06-29T09:27:20.9466667+00:00

    Hi Sri •,

    Welcome to Microsoft Q&A forum and thanks for using Azure Services.

    As I understand, you want to transfer data from from azure cosmos db to on premise mongodb.

    Could you please try using Azure Data Factory -Copy Activity and see if that helps for your usecase.

    Steps would be as follows:

    Select source as Azure Cosmos Mongo DB API, created Linked service, connect to Source Dataset.

    Then, use Target(Sink) as Mongo DB On-premises by creating it's Linked Service.

    Execute the pipeline and see if this meets your requirement.

    https://video2.skills-academy.com/en-us/azure/data-factory/connector-mongodb?tabs=data-factory

    Hope this helps. If this answers your query, do click Accept Answer and Mark Helpful for the same. And, if you have any further query do let us know.

    Thank you

    0 comments No comments