How make a dynamic JSON for mongoDB ?

Highlighted
Four Stars

How make a dynamic JSON for mongoDB ?

Hello,

 

I would like to insert data into a NoSQL DataBase (MongoDB).

 

The problem is I the format of my Json will change very often, example:

 

{

name: "okoo",

quality: "good"

}

OR

{

designation: "comportement",

type: "forge"

}

 

I can't know what will it be in my JSON.

 

So my question is how can I send a JSON to the component tMongoDBOutput, because I have the impression it needs a shema! 

Moderator

Re: How make a dynamic JSON for mongoDB ?

Hello,

Feature of dynamic schema is not supported for MongoDB components as of now.

A new feature jira issue has been submitted to address it in future release.https://jira.talendforge.org/browse/TBD-3134

Could you try to make use of tExtractJson components and meet the requirement?

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.
Four Stars

Re: How make a dynamic JSON for mongoDB ?

This new feature was created on February 2016, do you know if they are progressing? 

 

I'm trying to make a dynamic json with tJavaRow and send it to tMongoDbOutput, but it's not working. Do you have any other ideas?

Moderator

Re: How make a dynamic JSON for mongoDB ?

Hello,

Feel free to vote for this new feature jira issue.

Depending up on your usecase, are you able to make use of tExtractJson components and meet the requirement else one can restrict to use set schema option?

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.
Four Stars

Re: How make a dynamic JSON for mongoDB ?

I'll explain you my use case, maybe you'll have an idea I didn't think. 

Untitled Diagram.png

I'm listing a SQL Server Database, and when there is an insert or update in this Database, I get the new Data. 

The row that will be returned to me may be different depending on the table that has just been modified (So I need a dynamic schema).

When I have this new data, I want to insert it in MongoDB. The problem is, my schema is dynamic and I can't push this dynamic schema to MongoDB.

 

What do you think? 

Four Stars

Re: How make a dynamic JSON for mongoDB ?

Hello,

 

Here's my approach for this problem.

You route your SQL input to a tWriteJSONField that generates the JSON, and then you send it to a tMongoDBRow using a function or a command.

Here's an example, using a tFixedFlowInput to generate some rows, just replace it with your Db row input.

Mongo JSON flow.pngInputmongo json schema.pngJSON schemamongo json tree.pngJSON tree

("Remove root node" is important !)

mongo json row.pngOutput command

 

Hope this will help.

 

Regards,

 

--
Pierre Réveillon

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences

Blog

Talend Integration with Databricks

Take a look at this video about Talend Integration with Databricks

Watch Now