Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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
}"
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