Skip to content

Commit f5afc30

Browse files
per305per305
per305
authored and
per305
committed
Code review changes - script to soft delete TSR hub documents
1 parent 1d2a854 commit f5afc30

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Diff for: scripts/RestClient/nesp/cleanNespDocuments.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22

33
var projectIdArr = ['d748bd95-0b4d-450c-8fa4-20a7bcfd9c19','08e07841-764c-4fcd-8bbc-7dc38e6fbd5f']
44

5-
db.document.update({$and:[{"projectId": {$in: projectIdArr}},{"contentType": "application/pdf"}]},{$set:{"status": "deleted"}},{multi: true})
65

7-
var documents = db.document.find({"projectId":{$in:projectIdArr}})
6+
var numOfDocumentsToBeUpdated = db.document.find({$and:[{"projectId": {$in: projectIdArr}},{"contentType": "application/pdf"}]}).count()
7+
print("Number of documents to be updated: " + numOfDocumentsToBeUpdated)
8+
9+
var numOfDocumentsUpdated = db.document.update({$and:[{"projectId": {$in: projectIdArr}},{"contentType": "application/pdf"}]},{$set:{"status": "active"}},{multi: true})
10+
print("Number of documents updated: " + numOfDocumentsUpdated)
11+
12+
var documents = db.document.find({$and:[{"projectId": {$in: projectIdArr}},{"contentType": "application/pdf"}]})
813

914
var doc = "";
1015
var documentId = "";

0 commit comments

Comments
 (0)