How to query mongodb with DBRef

Highlighted
Five Stars

How to query mongodb with DBRef

Hello,

I have a database structure for Collection1 with a field with dbref like this:

 

"field_name" : DBRef("Collection2", ObjectId("5c3e25aaf1a79a001f1dbb08"), "database_name")

 

 

I want to get only the ObjectId of the field_name with tMongoDBInput but I can't do it.

 

With MongoShell, I can do it with this request :

db.Collection1.find({},{"Collection2.$id":1})

 

Anyone has any idea? Thanks.

Moderator

Re: How to query mongodb with DBRef

Hello,

Are you able to use the tMongoDBRow component to run a simple command like the following: "db.TalendTest.find()"?

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.

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

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog