Skip to main content

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
sathota
Contributor

Insert multiple array sub-document into mongoDB Collection

Hi,

I have 4 tables in Oracle with 1 -> N relation ship.( one customer has multiple addresses and multiple Emails, and Multiple Phone numbers).

  1. Customer Table
  2. CustomerAddress Table
  3. CustomerEmails Table
  4. Customer Phone Numbers Table

I want to take the data from above tables and insert into MongoDB Collection with below structure.

{

 "Customerid": "100",

 "CustomerName": "XXXX",

 "type": "Retail",

 "Addresses": {

  "Address": [

   {

    "Address_ID": 1,

    "Address1": "Local",

    "City": "Lowell",

    "State": "MA",

    "Zip": "123456",

    "Country": "USA"

   },

   {

    "Address_ID": 2,

    "Address1 ": "Local",

    "City": "Shrewsbury",

    "State": "MA",

    "Zip": "75248",

    "Country": "USA"

   }

  ]

 },

 "Emails": {

  "Email": [

   {

    "Email_ID": 1,

    "Email": "abc@gmail.com"

   },

   {

    "Email_ID": 2,

    "Email ": "xyz@hotmail.com"

   }

  ]

 },

 "PhoneNumbers": {

  "Phone": [

   {

    "Phone_ID": 1,

    "Number": "123-456-1234"

   },

   {

    "Phone_ID": 2,

    "Number ": "123-456-1234"

   }

  ]

 }

}

Can Someone help me how to do this?

Thanks,

Surendra

Labels (3)
0 Replies