From 031573e022cd916be5034e9d80115324cc4476de Mon Sep 17 00:00:00 2001 From: Julien Georges Date: Mon, 30 Oct 2023 11:38:35 +0100 Subject: [PATCH] Story 11250: Update deprecated remove method in the mongo shell. https://www.mongodb.com/docs/mongodb-shell/reference/compatibility/#deprecated-methods --- .../templates/referential/01_referential.js.j2 | 2 +- .../archive-search/01_archive-search.js.j2 | 2 +- .../templates/ingest/01_ingest.js.j2 | 2 +- .../scripts/mongod/1.0.0/01_iam_ref.js.j2 | 18 +++++++++--------- .../scripts/mongod/1.0.0/02_security_ref.js.j2 | 2 +- .../mongod/1.0.0/03_application_ref.js.j2 | 2 +- ...05_security.populate_certificates_ref.js.j2 | 2 +- ...security.populate_certificates_pastis.js.j2 | 4 ++-- ...15_security.populate_certificates_ref.js.j2 | 4 ++-- ...d_default_external_parameters_profile.js.j2 | 2 +- .../06_create_search_criteria_history.js.j2 | 2 +- .../48_migrate_archivesearch_profiles.js.j2 | 2 +- ...am_internal.populate_certificates_ref.js.j2 | 2 +- ...s_collection_with_collect_certificate.js.j2 | 4 ++-- ...reate_search_criteria_history_collect.js.j2 | 2 +- 15 files changed, 26 insertions(+), 26 deletions(-) diff --git a/deployment/roles/init_app_bdd/templates/referential/01_referential.js.j2 b/deployment/roles/init_app_bdd/templates/referential/01_referential.js.j2 index ff45c240e49..81ea226d6f2 100644 --- a/deployment/roles/init_app_bdd/templates/referential/01_referential.js.j2 +++ b/deployment/roles/init_app_bdd/templates/referential/01_referential.js.j2 @@ -772,7 +772,7 @@ db.contexts.updateOne( {% macro insertCertififcate(pemFile, contextId) -%} -db.certificates.remove( +db.certificates.deleteOne( {"_id" : "{{ pemFile | basename | replace('.pem','_cert')}}"}, { justOne: true } ) diff --git a/deployment/roles/init_archive_search_app_bdd/templates/archive-search/01_archive-search.js.j2 b/deployment/roles/init_archive_search_app_bdd/templates/archive-search/01_archive-search.js.j2 index cecd5e724d6..7537b59b972 100644 --- a/deployment/roles/init_archive_search_app_bdd/templates/archive-search/01_archive-search.js.j2 +++ b/deployment/roles/init_archive_search_app_bdd/templates/archive-search/01_archive-search.js.j2 @@ -123,7 +123,7 @@ db.contexts.updateOne( {% macro insertCertififcate(pemFile, contextId) -%} -db.certificates.remove( +db.certificates.deleteOne( {"_id" : "{{ pemFile | basename | replace('.pem','_cert')}}"}, { justOne: true } ) diff --git a/deployment/roles/init_ingest_app_bdd/templates/ingest/01_ingest.js.j2 b/deployment/roles/init_ingest_app_bdd/templates/ingest/01_ingest.js.j2 index ed2bc40a736..12c1c945d65 100644 --- a/deployment/roles/init_ingest_app_bdd/templates/ingest/01_ingest.js.j2 +++ b/deployment/roles/init_ingest_app_bdd/templates/ingest/01_ingest.js.j2 @@ -124,7 +124,7 @@ db.contexts.updateOne( {% macro insertCertififcate(pemFile, contextId) -%} -db.certificates.remove( +db.certificates.deleteOne( {"_id" : "{{ pemFile | basename | replace('.pem','_cert')}}"}, { justOne: true } ) diff --git a/deployment/scripts/mongod/1.0.0/01_iam_ref.js.j2 b/deployment/scripts/mongod/1.0.0/01_iam_ref.js.j2 index 0697e7411d8..0bb76f983bb 100644 --- a/deployment/scripts/mongod/1.0.0/01_iam_ref.js.j2 +++ b/deployment/scripts/mongod/1.0.0/01_iam_ref.js.j2 @@ -2,15 +2,15 @@ db = db.getSiblingDB('iam') print("START 01_iam_ref.js"); -db.users.remove({}); -db.groups.remove({}); -db.profiles.remove({}); -db.tenants.remove({}); -db.providers.remove({}); -db.owners.remove({}); -db.customers.remove({}); -db.sequences.remove({}); -db.tokens.remove({}); +db.users.deleteMany({}); +db.groups.deleteMany({}); +db.profiles.deleteMany({}); +db.tenants.deleteMany({}); +db.providers.deleteMany({}); +db.owners.deleteMany({}); +db.customers.deleteMany({}); +db.sequences.deleteMany({}); +db.tokens.deleteMany({}); db.createCollection('events'); db.createCollection('operations'); diff --git a/deployment/scripts/mongod/1.0.0/02_security_ref.js.j2 b/deployment/scripts/mongod/1.0.0/02_security_ref.js.j2 index cbdcb9f93a6..fe7725dac76 100644 --- a/deployment/scripts/mongod/1.0.0/02_security_ref.js.j2 +++ b/deployment/scripts/mongod/1.0.0/02_security_ref.js.j2 @@ -2,7 +2,7 @@ db = db.getSiblingDB('security') print("START 02_security_ref.js"); -db.contexts.remove({}); +db.contexts.deleteMany({}); db.createCollection('events'); db.contexts.insertOne({ diff --git a/deployment/scripts/mongod/1.0.0/03_application_ref.js.j2 b/deployment/scripts/mongod/1.0.0/03_application_ref.js.j2 index b9165b468ab..79d99a90160 100644 --- a/deployment/scripts/mongod/1.0.0/03_application_ref.js.j2 +++ b/deployment/scripts/mongod/1.0.0/03_application_ref.js.j2 @@ -1,6 +1,6 @@ db = db.getSiblingDB('{{ mongodb.iam.db }}') -db.applications.remove({}); +db.applications.deleteMany({}); db.applications.insertOne({ "identifier" : "CUSTOMERS_APP", diff --git a/deployment/scripts/mongod/1.0.0/05_security.populate_certificates_ref.js.j2 b/deployment/scripts/mongod/1.0.0/05_security.populate_certificates_ref.js.j2 index ce0f299aac5..4e75e738f5e 100644 --- a/deployment/scripts/mongod/1.0.0/05_security.populate_certificates_ref.js.j2 +++ b/deployment/scripts/mongod/1.0.0/05_security.populate_certificates_ref.js.j2 @@ -3,7 +3,7 @@ db = db.getSiblingDB('{{ mongodb.security.db }}') print("START security.populate_certificates_ref.js"); {% macro insertCertificate(pemFile, contextId, host) -%} -db.certificates.remove( +db.certificates.deleteOne( {"_id" : "{{ host }}_{{ pemFile | basename | replace('.pem','_cert')}}"}, { justOne: true } ) diff --git a/deployment/scripts/mongod/1.0.0/224_security.populate_certificates_pastis.js.j2 b/deployment/scripts/mongod/1.0.0/224_security.populate_certificates_pastis.js.j2 index fc4f97ee4f3..1425594ef3d 100644 --- a/deployment/scripts/mongod/1.0.0/224_security.populate_certificates_pastis.js.j2 +++ b/deployment/scripts/mongod/1.0.0/224_security.populate_certificates_pastis.js.j2 @@ -3,11 +3,11 @@ db = db.getSiblingDB('{{ mongodb.security.db }}') print("START 224_security.populate_certificates_pastis.js.j2"); {% macro insertCertificate(pemFile, contextId, host) -%} -db.certificates.remove( +db.certificates.deleteOne( {"_id" : "{{ pemFile | basename | replace('.pem','_cert')}}"}, { justOne: true } ) -db.certificates.remove( +db.certificates.deleteOne( {"_id" : "{{ host }}_{{ pemFile | basename | replace('.pem','_cert')}}"}, { justOne: true } ) diff --git a/deployment/scripts/mongod/1.0.0/315_security.populate_certificates_ref.js.j2 b/deployment/scripts/mongod/1.0.0/315_security.populate_certificates_ref.js.j2 index c1be64ff969..4ec4d4abefb 100644 --- a/deployment/scripts/mongod/1.0.0/315_security.populate_certificates_ref.js.j2 +++ b/deployment/scripts/mongod/1.0.0/315_security.populate_certificates_ref.js.j2 @@ -5,11 +5,11 @@ db = db.getSiblingDB('{{ mongodb.security.db }}') print("START 315_security.populate_certificates_ref.js"); {% macro insertCertificate(pemFile, contextId, host) -%} -db.certificates.remove( +db.certificates.deleteOne( {"_id" : "{{ host }}_{{ pemFile | basename | replace('.pem','_cert')}}"}, { justOne: true } ) -db.certificates.remove( +db.certificates.deleteOne( {"_id" : "{{ pemFile | basename | replace('.pem','_cert')}}"}, { justOne: true } ) diff --git a/deployment/scripts/mongod/2.0.0/04_add_default_external_parameters_profile.js.j2 b/deployment/scripts/mongod/2.0.0/04_add_default_external_parameters_profile.js.j2 index ca74efad1d8..4cf30d40853 100644 --- a/deployment/scripts/mongod/2.0.0/04_add_default_external_parameters_profile.js.j2 +++ b/deployment/scripts/mongod/2.0.0/04_add_default_external_parameters_profile.js.j2 @@ -2,7 +2,7 @@ db = db.getSiblingDB('iam') print("START 04_add_default_external_parameters_profile.js.j2"); -db.externalParameters.remove({}); +db.externalParameters.deleteMany({}); db.createCollection('externalParameters', { autoIndexId: true }); var maxIdProfile = db.getCollection('sequences').findOne({ '_id': 'profile_identifier' }).sequence; diff --git a/deployment/scripts/mongod/2.0.0/06_create_search_criteria_history.js.j2 b/deployment/scripts/mongod/2.0.0/06_create_search_criteria_history.js.j2 index 486e532961b..87213faa071 100644 --- a/deployment/scripts/mongod/2.0.0/06_create_search_criteria_history.js.j2 +++ b/deployment/scripts/mongod/2.0.0/06_create_search_criteria_history.js.j2 @@ -2,7 +2,7 @@ db = db.getSiblingDB('{{ mongodb.archivesearch.db }}') print("START 06_create_search_criteria_history.js"); -db.searchCriteriaHistories.remove({}); +db.searchCriteriaHistories.deleteMany({}); db.createCollection('searchCriteriaHistories', {autoIndexId: true}); print("END 06_create_search_criteria_history.js"); diff --git a/deployment/scripts/mongod/2.0.0/48_migrate_archivesearch_profiles.js.j2 b/deployment/scripts/mongod/2.0.0/48_migrate_archivesearch_profiles.js.j2 index cececa91fab..72a57cad1a3 100644 --- a/deployment/scripts/mongod/2.0.0/48_migrate_archivesearch_profiles.js.j2 +++ b/deployment/scripts/mongod/2.0.0/48_migrate_archivesearch_profiles.js.j2 @@ -43,7 +43,7 @@ db.groups.aggregate([ }); //======== DELETE OLD PROFILES FOR APP ARCHIVE_SEARCH_MANAGEMENT_APP ========// -db.profiles.remove( +db.profiles.deleteMany( { $and: [ { "applicationName": "ARCHIVE_SEARCH_MANAGEMENT_APP" }, diff --git a/deployment/scripts/mongod/5.4.0/002_RABB-1262_add_iam_internal.populate_certificates_ref.js.j2 b/deployment/scripts/mongod/5.4.0/002_RABB-1262_add_iam_internal.populate_certificates_ref.js.j2 index e456cc256be..bad4220f6aa 100644 --- a/deployment/scripts/mongod/5.4.0/002_RABB-1262_add_iam_internal.populate_certificates_ref.js.j2 +++ b/deployment/scripts/mongod/5.4.0/002_RABB-1262_add_iam_internal.populate_certificates_ref.js.j2 @@ -3,7 +3,7 @@ print("START 002_RABB-1262_add_iam_internal.populate_certificates_ref.js"); db = db.getSiblingDB('security') {% macro insertCertificate(pemFile, contextId, host) -%} -db.certificates.remove( +db.certificates.deleteOne( {"_id" : "{{ host }}_{{ pemFile | basename | replace('.pem','_cert')}}"}, { justOne: true } ) diff --git a/deployment/scripts/mongod/6.rc.0/04_update_certificates_collection_with_collect_certificate.js.j2 b/deployment/scripts/mongod/6.rc.0/04_update_certificates_collection_with_collect_certificate.js.j2 index 7df024405e8..22213e1c210 100644 --- a/deployment/scripts/mongod/6.rc.0/04_update_certificates_collection_with_collect_certificate.js.j2 +++ b/deployment/scripts/mongod/6.rc.0/04_update_certificates_collection_with_collect_certificate.js.j2 @@ -4,11 +4,11 @@ print("START 6.rc.0/04_update_certificates_collection_with_collect_certificate.j {% macro insertCertificate(pemFile, contextId, host) -%} -db.certificates.remove( +db.certificates.deleteOne( {"_id" : "{{ pemFile | basename | replace('.pem','_cert')}}"}, { justOne: true } ) -db.certificates.remove( +db.certificates.deleteOne( {"_id" : "{{ host }}_{{ pemFile | basename | replace('.pem','_cert')}}"}, { justOne: true } ) diff --git a/deployment/scripts/mongod/6.rc.0/08_create_search_criteria_history_collect.js.j2 b/deployment/scripts/mongod/6.rc.0/08_create_search_criteria_history_collect.js.j2 index 6fd67797a82..5203d8a6703 100644 --- a/deployment/scripts/mongod/6.rc.0/08_create_search_criteria_history_collect.js.j2 +++ b/deployment/scripts/mongod/6.rc.0/08_create_search_criteria_history_collect.js.j2 @@ -2,7 +2,7 @@ db = db.getSiblingDB('{{ mongodb.archivesearch.db }}') print("START 08_create_search_criteria_history_collect.js"); -db.searchCriteriaHistoriesCollect.remove({}); +db.searchCriteriaHistoriesCollect.deleteMany({}); db.createCollection('searchCriteriaHistoriesCollect', {autoIndexId: true}); print("END 08_create_search_criteria_history_collect.js");