Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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

 

Labels (2)
3 Replies
Anonymous
Not applicable
Author

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

Anonymous
Not applicable
Author

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

Anonymous
Not applicable
Author

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