All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
scripts.3.7.0.1-rename-collections-with-prefix.js Maven / Gradle / Ivy
print('Add a prefix to all collections');
const collections = [
'apiqualityrules',
'applications',
'keys',
'identity_provider_activations',
'users',
'tickets',
'genericnotificationconfigs',
'workflows',
'environments',
'invitations',
'client_registration_providers',
'page_revisions',
'ratingAnswers',
'apis',
'rating',
'themes',
'metadata',
'alert_triggers',
'parameters',
'dashboards',
'events',
'identity_providers',
'audits',
'categories',
'tenants',
'portalnotifications',
'custom_user_fields',
'alert_events',
'roles',
'entrypoints',
'metadatas',
'memberships',
'dictionaries',
'qualityrules',
'pages',
'groups',
'portalnotificationconfigs',
'installation',
'notificationTemplates',
'commands',
'tokens',
'apiheaders',
'plans',
'tags',
'subscriptions',
'organizations',
];
try {
// Use your prefix here
const prefix = "";
const rateLimitPrefix = "";
collections.forEach(collectionName => {
db.getCollection(collectionName).renameCollection(`${prefix}${collectionName}`);
})
db.ratelimit.renameCollection(`${rateLimitPrefix}ratelimit`);
} catch(e) {
print(`Error while renaming collection.\nError: ${e}`);
}