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

What’s New for Talend Spring ’19

Join us live for a sneak peek!

Sign up now

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download