Question

How to Convert from SQL Server to MongoDB with Embedded Attributes

  • 11 April 2017
  • 0 replies
  • 2 views

Hey,

Sorry but I could not find an Answer on this Topic. (Generally the Tuts from safe are Kind minimalistic)

To my Question how can I convert from Sql Server to MongoDB with Embedded Attributes.

In SQL I got this 3 Tables

Table Parts// Cardinality to Prices (1:n) and Archive (1:n)

IdName...1Ball..............

Table Prices

IdPrice...11,50€............

Table Archive

IdOldPrice...11,49€...........

The Simple 1 to 1 Convert is working

The 3 Tables are Identically in my MongoDB as 3 Collections.

But I want to have 1 Collection ( 3 in 1 as "BestPractice of MongoDB")

https://docs.mongodb.com/manual/tutorial/model-embedded-one-to-many-relationships-between-documents/

But I cant find a Transformer for this or other Functions?

How can I achieve something like this

{//Parts as Primary
_id : 14011,
isATPart : 0,
SuppID : ["BMW","MINI"]
...
priceByCountry:[{ Prices
countryStr: "DE",
CurrStr: "EUR",
....
archiv:[{//Prices_Archiv
price : 2,50€,
date : 31.02.17,
ListId: 1234
},
{
price : 2,50€,
date : 31.01.17,
ListId: 1233
}]
},{..AT..}
]
}

Sidenote:

I accept as well answers as how this can be solved/converted from MongoDB to MongoDB because Ive got allready the 3 Tables in MongoDB now and need only to "merge" them

Thx all for Help


0 replies

Be the first to reply!

Reply