- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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).
- Customer Table
- CustomerAddress Table
- CustomerEmails Table
- 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