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.

3
  • What is wrong with 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. Commented Mar 10, 2016 at 2: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, Commented Mar 10, 2016 at 2: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. Commented Mar 10, 2016 at 4:21

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.