How to query mongodb with DBRef

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.

Highlighted
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 GARTNER 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

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog