Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Insert ObjectID from Mongodb Collection A to Collection B in Mongodb

I am new to using Talend. I am not able to carry over the ObjectID from Mongodb collection A to Mongodb collection B. I am using a 

How to carry over a objectID from Mongodb's collection A to a new mongodb collection B. I am using the following logic to execute. TMongoDBInput-->tmap-->tMongoDBOutput. I have mapped the link target in tMongoDBOutput to have the _id field's static value mapped as object where the _id field attribute is defined as class.  I am still seeing ObjectID as string in collection B. What am i missing here ? Appreciate the help. Thanks 

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

This problem was solved by making the attribute type of _id as @type and setting the Static Value to object in the Link target. 

View solution in original post

4 Replies
Anonymous
Not applicable
Author

This problem was solved by making the attribute type of _id as @type and setting the Static Value to object in the Link target. 

krengan21
Creator
Creator

Hi,

 

Can you share me the screenshot so that i can get a clear idea about it.

 

Thanks and Regards,

Kasthuri Rengan

Anonymous
Not applicable
Author

I too, would like to get a more explicit answer...
My problem is I need to insert from mysql to mongoDB.

 

But some field in my output table are ObjectId fields (which talend identified as string upon retrieving the schema)

Upon insert I match one Mysql column data on a mongoDB collection (label field) and get the corresponding _id (as a string)
But I need to put that in the mongoDB output on a reference ObjectId field (for another collection, just as a "foreign key").

 

I tried to import Bson objectId and do a ObjectId(MyStringId) / ObjectId.Parse(MyStringId) with no success.


Talend.PNG
krengan21
Creator
Creator

Try reading the data type as object while fetching it from the source and change the data type to object in output schema also it should solve your problem.

Don't forget to give Kudos if this solution is working .
Regards,
Kasthuri Rengan