Five Stars

MySQL to MongoDB problems

Hello,

 

i want to migrate data from mysql database to mongo database. I'll take a simple example to illustrate my problem. I've got two mysql tables :

Example_1.png

 

And i want this result in MongoDB :

 

 Example_2.png

 

 I don't know how to do this. Do you have any idea ?

 

Thanks for your help

 

Tags (2)
4 REPLIES
Moderator

Re: MySQL to MongoDB problems

Hello,

Is your input data JSON field from your mysql DB?

Please have a look at this component reference: TalendHelpCenter:tExtractJSONFields which is used to extract the desired data from JSON fields based on the JSONPath or XPath query.

And then you can generate directly desired result with tMongodbOutput by using 'Generate JSON Document' in advanced settings of tMongodbOutput component.

Best regards

Sabrina

 

 

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Five Stars

Re: MySQL to MongoDB problems

I'll try your solution.

 

Thanks for your help

Moderator

Re: MySQL to MongoDB problems

Hello,

Feel free to let us know if it is OK with you.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Five Stars

Re: MySQL to MongoDB problems

Hello,

 

I used a tWriteJsonFields, it worked but now i can't handle exporting the JSON data to Mongo with tMongoDBOutput.

 

I don't use the tExtractJsonFields component because when the job started, i only have mysql data tables input, and not a json file or json string.

 

Thanks