0

I want to create a utility which can help in migrating data from Relational DB(Oracle) to MongoDB. Plan is :-
Relation DB -> CSV(staging area) -> BSON format
(conversion to BSON will be based on mappings provided by various use cases).
Once BSON is created, Mongo DB's ‘Import’ tool will be used for loading data.

Need suggestions from this expert forum on following problem statement:-
"Most of the relational tables are highly normalized. When I join them to create the data entity, I end up with multiple rows (E.g. An employee having 3 phone numbers results in 3 rows in CSV file). I need to map/convert these three records into one document on BSON (for embedded document structure)."

Please suggest how to achieve this.

Vibha
  • 939
  • 9
  • 17
  • What is wrong with [mongoimport](https://docs.mongodb.org/manual/reference/program/mongoimport/)? Outside of that, if you are actually asking *"How should I transform all of my relational structure to MongoDB?"*, then that is way **"too-broad"* a question. – Blakes Seven Mar 10 '16 at 02:26
  • Hi Blakes. I think mongoimport starts with BSON file. I am facing issue in a particular scenario of BSON creation - when multiple records of relational DB need to transform into one document on BSON side, – Vibha Mar 10 '16 at 02:37
  • Nope. The purpose of `mongoimport` ( link given earlier so you would read it ) is to import "text" content, being either in JSON, CSV or TSV format. You're likely thinking `mongorestore`, which is BSON binary backups. – Blakes Seven Mar 10 '16 at 04:21

1 Answers1

0

Thanks Blakes and Saleem.I am new to MongoDB and didn't know it can import CSV directly.

Few other threads talking on similar issue:-
MongoDB - Import CSV into nested document
Using mongoimport to read CSV into nested structure?
Create nested JSON from CSV

Anyone facing the above issue can look at these threads also.

Community
  • 1
  • 1
Vibha
  • 939
  • 9
  • 17