Reading from MongoDB secondary server

Seven Stars

Reading from MongoDB secondary server

Hi,

I am using "replica set address" to connect to mongoDB using tMongoDBInput. I have given the "Set read preference" option as "secondary" to fetch from MongoDB secondary server. But, I am getting the below exception:

" Exception in component tMongoDBInput_2

com.mongodb.CommandFailureException: { "serverUsed" : "xxxxxxxxxx.abcd.local:27017" , "ok" : 0.0 , "errmsg" : "not master and slaveOk=false" , "code" : 13435 , "codeName" : "NotMasterNoSlaveOk"}

      at com.mongodb.CommandResult.getException(CommandResult.java:76)

      at com.mongodb.CommandResult.throwOnError(CommandResult.java:140)

      at com.mongodb.DBCollectionImpl.aggregate(DBCollectionImpl.java:113)

      at com.mongodb.DBCollection.aggregate(DBCollection.java:1814) "

 

Can you please let me know how to fix this issue and suggest any thoughts on this?

Server details in above exception is dummy.

Highlighted
Moderator

Re: Reading from MongoDB secondary server

Hello,

Can you please clarify in which Talend version/edition you are? What's MongoDB version are you using?

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

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog