Getting error while trying to update a document using tMongoDBRow

Five Stars

Getting error while trying to update a document using tMongoDBRow

I have a mongodb sharded cluster and I am trying to run update command on one of my collection using tMongoDBRow component. Inside the component I am running the update command as a function. However, when I am running Talend job I am getting this error - "shard version not ok: version epoch mismatch detected for <database.collection>, the collection may have been dropped and recreated".

 

Any help in resolving the issue is greatly appreciated. Thanks.

 

MongoDB version - 3.6.2

Talend Open Studio for Big Data version - 7.1.1

 

Moderator

Re: Getting error while trying to update a document using tMongoDBRow

Hello,

Here exists a jira issue from MongoDB's Issue Tracker.

Could you please have a look at it?

https://jira.mongodb.org/browse/SERVER-28019

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

Re: Getting error while trying to update a document using tMongoDBRow

Hi Sabrina - Thanks for your response. However, I was able to get a workaround to my issue. I was able to execute update command in MongoDB using tMongoDBRow component by using "Execute command >> Construct command from a JSON string" and then providing following JSON string command and it is important to note that shard key should be used in "query" in below command, so in this case field1, field2, field3 should be your shard key - 

 

"{findAndModify: '<collection name>',
query: {'<field1>': '<value1>',

            '<field2>': '<value2>',

            '<field3>': '<value3>'},
update: { '$set': {'field4': 'value4'} }

 

Regards,

Puneet
}"

Five Stars

Re: Getting error while trying to update a document using tMongoDBRow

Hi Sabrina - Thanks for your response. However, I was able to get a workaround to my issue. I was able to execute update command in MongoDB using tMongoDBRow component by using "Execute command >> Construct command from a JSON string" and then providing following JSON string command and it is important to note that shard key should be used in "query" in below command, so in this case field1, field2, field3 should be your shard key - 

 

"{findAndModify: '<collection name>',
query: {'<field1>': '<value1>',

            '<field2>': '<value2>',

            '<field3>': '<value3>'},
update: { '$set': {'field4': 'value4'} }
}"

 

Regards,

Puneet

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

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download