【发布时间】:2022-02-23 17:36:38
【问题描述】:
我需要创建将在 mongo shell 上的脚本下运行的 kubernetes 作业:
var operations = [];
db.product.find().forEach(function(doc) {
var documentLink = doc.documentLink;
var operation = { updateMany :{
"filter" : {"_id" : doc._id},
"update" : {$set:{"documentLinkMap.en":documentLink,"documentLinkMap.de":""},
$unset: {documentLink:"","descriptionMap.tr":"","news.tr":"","descriptionInternal.tr":"","salesDescription.tr":"","salesInternal.tr":"","deliveryDescription.tr":"","deliveryInternal.tr":"","productRoadMapDescription.tr":"","productRoadMapInternal.tr":"","technicalsAndIntegration.tr":"","technicalsAndIntegrationInternal.tr":"","versions.$[].descriptionMap.tr":"","versions.$[].releaseNoteMap.tr":"","versions.$[].artifacts.$[].descriptionMap.tr":"","versions.$[].artifacts.$[].artifactNotes.tr":""}}}};
operations.push(operation);
});
operations.push( {
ordered: true,
writeConcern: { w: "majority", wtimeout: 5000 }
});
db.product.bulkWrite(operations);
我需要一份这份工作的样板。我应该创建持久卷并声明它,还是有可能在没有持久卷的情况下运行此作业?我需要运行一次,然后删除它。
【问题讨论】:
标签: mongodb shell kubernetes jobs