From 23c157b263f7626e66dfa805e9d37cf3a6b06740 Mon Sep 17 00:00:00 2001 From: Zhenya Tikhonov Date: Sun, 21 Sep 2025 18:28:40 +0400 Subject: [PATCH 1/7] docs: use correct index definitions --- indexes/codefresh/agenttasks.json | 10 +- .../codefresh/feature-store-versioned.json | 10 +- indexes/codefresh/users.json | 6 +- indexes/codefresh/workflowprocesses.json | 176 +++---- indexes/read-models/analysisruns.json | 372 +++++++------- indexes/read-models/images-binaries.json | 42 +- indexes/read-models/product-releases.json | 132 +++-- indexes/read-models/releases.json | 44 +- indexes/read-models/rollouts.json | 472 ++++++++---------- 9 files changed, 582 insertions(+), 682 deletions(-) diff --git a/indexes/codefresh/agenttasks.json b/indexes/codefresh/agenttasks.json index 7e5b1f26f..5f3f9e015 100644 --- a/indexes/codefresh/agenttasks.json +++ b/indexes/codefresh/agenttasks.json @@ -1,6 +1,6 @@ [ { - "keys": { + "key": { "metadata.accountId": 1, "metadata.reIdentifier": 1, "metadata.shouldExecute": 1, @@ -10,11 +10,9 @@ } }, { - "keys": { + "key": { "metadata.expireAt": 1 }, - "options": { - "expireAfterSeconds": 0 - } + "expireAfterSeconds": 0 } -] \ No newline at end of file +] diff --git a/indexes/codefresh/feature-store-versioned.json b/indexes/codefresh/feature-store-versioned.json index e5c9af57f..08af07031 100644 --- a/indexes/codefresh/feature-store-versioned.json +++ b/indexes/codefresh/feature-store-versioned.json @@ -1,16 +1,14 @@ [ { - "keys": { + "key": { "createdAt": 1 }, - "options": { - "expireAfterSeconds": 43200 - } + "expireAfterSeconds": 43200 }, { - "keys": { + "key": { "_id": -1, "LDRedisStoreVersion": 1 } } -] \ No newline at end of file +] diff --git a/indexes/codefresh/users.json b/indexes/codefresh/users.json index 07200446a..4f06f548e 100644 --- a/indexes/codefresh/users.json +++ b/indexes/codefresh/users.json @@ -1,15 +1,15 @@ [ { - "keys": { + "key": { "account": 1, "_id": 1 } }, { - "keys": { + "key": { "role": 1, "account": 1, "_id": 1 } } -] \ No newline at end of file +] diff --git a/indexes/codefresh/workflowprocesses.json b/indexes/codefresh/workflowprocesses.json index 6f54ab77f..068a42dae 100644 --- a/indexes/codefresh/workflowprocesses.json +++ b/indexes/codefresh/workflowprocesses.json @@ -1,38 +1,38 @@ [ { - "keys": { + "key": { "account": 1, "pendingLicense": 1, "created": 1 } }, { - "keys": { + "key": { "pipeline": 1, "status": 1 } }, { - "keys": { + "key": { "account": 1, "triggerType": 1 } }, { - "keys": { + "key": { "account": 1, "pipelineInfo.pipelineId": 1 } }, { - "keys": { + "key": { "account": 1, "startImmediately": 1, "status": 1 } }, { - "keys": { + "key": { "account": 1, "scmMetadata.repoName": 1, "scmMetadata.repoOwner": 1, @@ -41,12 +41,12 @@ } }, { - "keys": { + "key": { "isPublic": 1 } }, { - "keys": { + "key": { "codefreshEnv": 1, "status": 1, "shouldPerformFinishSystem": 1, @@ -54,26 +54,26 @@ } }, { - "keys": { + "key": { "account": 1, "helmInfo.boardId": 1 } }, { - "keys": { + "key": { "account": 1, "environs": 1 } }, { - "keys": { + "key": { "account": 1, "status": 1, "trigger": 1 } }, { - "keys": { + "key": { "account": 1, "pipeline": 1, "trigger": 1, @@ -81,7 +81,7 @@ } }, { - "keys": { + "key": { "scmMetadata.branchName": 1, "account": 1, "pipeline": 1, @@ -90,7 +90,7 @@ } }, { - "keys": { + "key": { "trigger": 1, "account": 1, "status": 1, @@ -98,7 +98,7 @@ } }, { - "keys": { + "key": { "account": 1, "trigger": 1, "scmMetadata.repoName": 1, @@ -106,37 +106,37 @@ } }, { - "keys": { + "key": { "service": 1, "status": 1 } }, { - "keys": { + "key": { "finished": 1 } }, { - "keys": { + "key": { "healthStatus.engine.status": 1 } }, { - "keys": { + "key": { "codefreshEnv": 1, "status": 1, "_id": 1 } }, { - "keys": { + "key": { "account": 1, "service": 1, "trigger": 1 } }, { - "keys": { + "key": { "scmMetadata.branchName": 1, "service": 1, "status": 1, @@ -144,132 +144,126 @@ } }, { - "keys": { + "key": { "status": 1, "trigger": 1 } }, { - "keys": { + "key": { "pipeline": 1, "finished": -1 } }, { - "keys": { + "key": { "progress": 1 } }, { - "keys": { + "key": { "account": 1, "environ": 1 } }, { - "keys": { + "key": { "status": 1, "created": -1 } }, { - "keys": { + "key": { "createdAt": 1 } }, { - "keys": { + "key": { "request": 1 } }, { - "keys": { + "key": { "account": 1, "_id": 1, "scmMetadata.repoName": 1 } }, { - "keys": { + "key": { "pipeline": 1, "created": -1 } }, { - "keys": { + "key": { "account": 1, "status": 1, "created": 1 } }, { - "keys": { + "key": { "status": 1, "runtimeEnvironmentMetadata.agent": 1, "created": 1 } }, { - "keys": { + "key": { "created": 1 } }, { - "keys": { + "key": { "account": 1, "status": 1, "trigger": 1, "pipeline": 1, "keepPVCsForPendingApproval": 1 }, - "options": { - "partialFilterExpression": { - "status": { - "$in": [ - "pending", - "delayed", - "elected", - "running", - "terminating", - "pending-approval" - ] - } + "partialFilterExpression": { + "status": { + "$in": [ + "pending", + "delayed", + "elected", + "running", + "terminating", + "pending-approval" + ] } } }, { - "keys": { + "key": { "account": 1, "scmMetadata.revision": 1, "_id": -1, "pipeline": 1 }, - "options": { - "partialFilterExpression": { - "scmMetadata.revision": { - "$exists": true - } + "partialFilterExpression": { + "scmMetadata.revision": { + "$exists": true } } }, { - "keys": { + "key": { "account": 1, "trigger": 1, "scmMetadata.userName": 1, "_id": -1, "pipeline": 1 }, - "options": { - "partialFilterExpression": { - "scmMetadata.userName": { - "$exists": true - } + "partialFilterExpression": { + "scmMetadata.userName": { + "$exists": true } } }, { - "keys": { + "key": { "account": 1, "trigger": 1, "annotations.key": 1, @@ -277,44 +271,38 @@ "_id": -1, "pipeline": 1 }, - "options": { - "sparse": true - } + "sparse": true }, { - "keys": { + "key": { "account": 1, "trigger": 1, "pipelineTrigger": 1, "_id": -1, "pipeline": 1 }, - "options": { - "partialFilterExpression": { - "pipelineTrigger": { - "$exists": true - } + "partialFilterExpression": { + "pipelineTrigger": { + "$exists": true } } }, { - "keys": { + "key": { "account": 1, "trigger": 1, "scmMetadata.branchName": 1, "_id": -1, "pipeline": 1 }, - "options": { - "partialFilterExpression": { - "scmMetadata.branchName": { - "$exists": true - } + "partialFilterExpression": { + "scmMetadata.branchName": { + "$exists": true } } }, { - "keys": { + "key": { "account": 1, "trigger": 1, "_id": -1, @@ -322,39 +310,35 @@ } }, { - "keys": { + "key": { "account": 1, "trigger": 1, "scmMetadata.provider": 1, "_id": -1, "pipeline": 1 }, - "options": { - "partialFilterExpression": { - "scmMetadata.provider": { - "$exists": true - } + "partialFilterExpression": { + "scmMetadata.provider": { + "$exists": true } } }, { - "keys": { + "key": { "account": 1, "trigger": 1, "scmMetadata.repoName": 1, "_id": -1, "pipeline": 1 }, - "options": { - "partialFilterExpression": { - "scmMetadata.repoName": { - "$exists": true - } + "partialFilterExpression": { + "scmMetadata.repoName": { + "$exists": true } } }, { - "keys": { + "key": { "account": 1, "trigger": 1, "scmMetadata.provider": 1, @@ -362,19 +346,17 @@ "_id": -1, "pipeline": 1 }, - "options": { - "partialFilterExpression": { - "scmMetadata.event": { - "$exists": true - }, - "scmMetadata.provider": { - "$exists": true - } + "partialFilterExpression": { + "scmMetadata.event": { + "$exists": true + }, + "scmMetadata.provider": { + "$exists": true } } }, { - "keys": { + "key": { "pipeline": 1, "_id": -1 } diff --git a/indexes/read-models/analysisruns.json b/indexes/read-models/analysisruns.json index 7c8071247..1c3a52793 100644 --- a/indexes/read-models/analysisruns.json +++ b/indexes/read-models/analysisruns.json @@ -1,250 +1,226 @@ [ { - "keys": { + "key": { "__passiveReferencedBy.name": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "__passiveReferencedBy.name": 1, "__passiveReferencedBy.kind": 1, "__passiveReferencedBy.namespace": 1, "__passiveReferencedBy.group": 1, "__passiveReferencedBy.version": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "__passiveReferences.name": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "__passiveReferences.name": 1, "__passiveReferences.kind": 1, "__passiveReferences.namespace": 1, "__passiveReferences.group": 1, "__passiveReferences.version": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "__inferredReferencedBy.name": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "__inferredReferencedBy.name": 1, "__inferredReferencedBy.kind": 1, "__inferredReferencedBy.namespace": 1, "__inferredReferencedBy.group": 1, "__inferredReferencedBy.version": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "__inferredReferences.name": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "__inferredReferences.name": 1, "__inferredReferences.kind": 1, "__inferredReferences.namespace": 1, "__inferredReferences.group": 1, "__inferredReferences.version": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "updatedAt": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "projects": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "metadata.name": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "metadata.labels": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "metadata.accountId": 1, "metadata.runtime": 1, "metadata.cluster": 1, @@ -256,24 +232,22 @@ "metadata.uid": 1, "metadata.revision": 1 }, - "options": { - "unique": true, - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "unique": true, + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "metadata.accountId": 1, "revision": 1, "metadata.labels.rollout-type": 1, @@ -282,7 +256,7 @@ } }, { - "keys": { + "key": { "metadata.accountId": 1, "revision": 1, "metadata.labels.rollout-type": 1, @@ -291,23 +265,21 @@ } }, { - "keys": { + "key": { "ownerReferences.uid": 1, "revision": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } } -] \ No newline at end of file +] diff --git a/indexes/read-models/images-binaries.json b/indexes/read-models/images-binaries.json index c8efda894..305dd4fe0 100644 --- a/indexes/read-models/images-binaries.json +++ b/indexes/read-models/images-binaries.json @@ -1,44 +1,44 @@ [ { - "keys": { + "key": { "accountId": 1, "imageName": 1, "repositoryName": 1 } }, { - "keys": { + "key": { "accountId": 1, "repositoryName": 1, "gitRepository": 1 } }, { - "keys": { + "key": { "accountId": 1, "repositoryName": 1, "branch": 1 } }, { - "keys": { + "key": { "runtime.name": 1 } }, { - "keys": { + "key": { "accountId": 1, "repoDigest": 1 } }, { - "keys": { + "key": { "accountId": 1, "internalImageId": 1 } }, { - "keys": { + "key": { "accountId": 1, "binaryId": 1, "lastUpdate": -1, @@ -46,23 +46,21 @@ } }, { - "keys": { + "key": { "accountId": 1, "imageName": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } } -] \ No newline at end of file +] diff --git a/indexes/read-models/product-releases.json b/indexes/read-models/product-releases.json index 0588ba775..94b7dc76f 100644 --- a/indexes/read-models/product-releases.json +++ b/indexes/read-models/product-releases.json @@ -1,105 +1,95 @@ [ { - "keys": { + "key": { "status": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "accountId": 1, "updatedAt": -1 }, - "options": { - "collation": { - "locale": "en", - "caseLevel": false, - "caseFirst": "off", - "strength": 2, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en", + "caseLevel": false, + "caseFirst": "off", + "strength": 2, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "accountId": 1, "productName": 1, "triggerCommit.sha": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "accountId": 1, "productName": 1, "status": 1, "triggerEnvironment": 1, "triggerCommit.sha": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "accountId": 1, "productName": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } } -] \ No newline at end of file +] diff --git a/indexes/read-models/releases.json b/indexes/read-models/releases.json index 731a06bb0..e83564629 100644 --- a/indexes/read-models/releases.json +++ b/indexes/read-models/releases.json @@ -1,46 +1,46 @@ [ { - "keys": { + "key": { "applicationMetadata.name": 1 } }, { - "keys": { + "key": { "applicationMetadata.labels": 1 } }, { - "keys": { + "key": { "application.prs.type": 1 } }, { - "keys": { + "key": { "application.prs.key": 1 } }, { - "keys": { + "key": { "application.prs.accountId": 1 } }, { - "keys": { + "key": { "application.issues.type": 1 } }, { - "keys": { + "key": { "application.issues.key": 1 } }, { - "keys": { + "key": { "application.issues.accountId": 1 } }, { - "keys": { + "key": { "applicationMetadata.accountId": 1, "applicationMetadata.runtime": 1, "applicationMetadata.name": 1, @@ -49,7 +49,7 @@ } }, { - "keys": { + "key": { "applicationMetadata.accountId": 1, "applicationMetadata.runtime": 1, "applicationMetadata.name": 1, @@ -58,7 +58,7 @@ } }, { - "keys": { + "key": { "applicationMetadata.accountId": 1, "applicationMetadata.runtime": 1, "applicationMetadata.name": 1, @@ -67,7 +67,7 @@ } }, { - "keys": { + "key": { "applicationMetadata.accountId": 1, "applicationMetadata.runtime": 1, "applicationMetadata.name": 1, @@ -77,12 +77,10 @@ "applicationMetadata.kind": 1, "historyId": -1 }, - "options": { - "unique": true - } + "unique": true }, { - "keys": { + "key": { "applicationMetadata.accountId": 1, "applicationMetadata.runtime": 1, "applicationMetadata.name": 1, @@ -95,14 +93,14 @@ } }, { - "keys": { + "key": { "fromState.services.revision": 1, "fromState.services.name": 1, "applicationMetadata.accountId": 1 } }, { - "keys": { + "key": { "syncOperationRevision": 1, "applicationMetadata.name": 1, "applicationMetadata.accountId": 1, @@ -110,31 +108,31 @@ } }, { - "keys": { + "key": { "applicationMetadata.name": 1, "applicationMetadata.accountId": 1, "historyId": -1 } }, { - "keys": { + "key": { "applicationMetadata.name": 1, "applicationMetadata.accountId": 1, "application.status.healthStatus": 1 } }, { - "keys": { + "key": { "applicationMetadata.name": 1, "applicationMetadata.accountId": 1, "current": 1 } }, { - "keys": { + "key": { "application.status.revision": 1, "applicationMetadata.name": 1, "applicationMetadata.accountId": 1 } } -] \ No newline at end of file +] diff --git a/indexes/read-models/rollouts.json b/indexes/read-models/rollouts.json index 0bb53806c..b59d2704e 100644 --- a/indexes/read-models/rollouts.json +++ b/indexes/read-models/rollouts.json @@ -1,288 +1,260 @@ [ { - "keys": { + "key": { "__passiveReferencedBy.name": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "__passiveReferencedBy.name": 1, "__passiveReferencedBy.kind": 1, "__passiveReferencedBy.namespace": 1, "__passiveReferencedBy.group": 1, "__passiveReferencedBy.version": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "__passiveReferences.name": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "__passiveReferences.name": 1, "__passiveReferences.kind": 1, "__passiveReferences.namespace": 1, "__passiveReferences.group": 1, "__passiveReferences.version": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "__inferredReferencedBy.name": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "__inferredReferencedBy.name": 1, "__inferredReferencedBy.kind": 1, "__inferredReferencedBy.namespace": 1, "__inferredReferencedBy.group": 1, "__inferredReferencedBy.version": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "__inferredReferences.name": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "__inferredReferences.name": 1, "__inferredReferences.kind": 1, "__inferredReferences.namespace": 1, "__inferredReferences.group": 1, "__inferredReferences.version": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "updatedAt": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "projects": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "metadata.name": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "metadata.labels": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "source.syncStartedAt": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "source.gitSource": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "metadata.accountId": 1, "metadata.runtime": 1, "metadata.cluster": 1, @@ -295,80 +267,72 @@ "metadata.uid": 1, "metadata.labels.app\\u002ekubernetes\\u002eio/instance": 1 }, - "options": { - "unique": true, - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "unique": true, + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "source.gitSourceUID": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "source.gitSourceNamespace": 1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } }, { - "keys": { + "key": { "metadata.appName": 1, "metadata.accountId": 1, "metadata.runtime": 1, "_id": -1 }, - "options": { - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false, + "version": "57.1" } } -] \ No newline at end of file +] From 8ef156d9049a9e7d38a4533d34680f2203e957ec Mon Sep 17 00:00:00 2001 From: Zhenya Tikhonov Date: Sun, 21 Sep 2025 18:45:06 +0400 Subject: [PATCH 2/7] docs: upgrade index creation instructions --- README.md.gotmpl | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/README.md.gotmpl b/README.md.gotmpl index 013502286..65cd28066 100644 --- a/README.md.gotmpl +++ b/README.md.gotmpl @@ -1492,7 +1492,8 @@ Use [obtain-oidc-id-token](https://github.com/codefresh-io/steps/blob/822afc0a9a Sometimes, in new releases of Codefresh On-Prem, index requirements change. When this happens, it's mentioned in the [Upgrading section](#upgrading) for the specific release. -> ℹ️ If you're upgrading from version `X` to version `Y`, and index requirements were updated in any of the intermediate versions, you only need to align your indexes with the index requirements of version `Y`. To do that, follow [Index alignment](#index-alignment) instructions. +> [!TIP] +> If you're upgrading from version `X` to version `Y`, and index requirements were updated in any of the intermediate versions, you only need to align your indexes with the index requirements of version `Y`. To do that, follow [Index alignment](#index-alignment) instructions. ### Index alignment @@ -1515,11 +1516,12 @@ indexes **Overview of the index alignment process:** 1. Identify the differences between the indexes in your MongoDB instance and the required index definitions. -2. Create any missing indexes one by one. (It's important not to create them in bulk.) +2. Create any missing indexes. 3. Perform the upgrade of Codefresh On-Prem installation. 4. Then remove any unnecessary indexes. -> ⚠️ **Note! Any changes to indexes should be performed during a defined maintenance window or during periods of lowest traffic to MongoDB.** +> [!IMPORTANT] +> Any changes to indexes should be performed during a defined maintenance window or during periods of lowest traffic to MongoDB.** > > Building indexes during time periods where the target collection is under heavy write load can result in reduced write performance and longer index builds. ([*Source: MongoDB official documentation*](https://www.mongodb.com/docs/manual/core/index-creation/#index-build-impact-on-database-performance)) > @@ -1542,19 +1544,32 @@ mongosh "" db.getSiblingDB('').getCollection('').getIndexes() ``` -- Compare your indexes with the required indexes for the target release, and adjust them by creating any missing indexes or removing any unnecessary ones +- Compare your indexes with the required indexes for the target release, and adjust them by creating any missing indexes or removing any unnecessary ones. **Index creation** -> ⚠ **Note! Always create indexes sequentially, one by one. Don't create them in bulk.** +- To create an indexes, we recommend using the `createIndexes` command ([ref](https://www.mongodb.com/docs/manual/reference/command/createIndexes/)): -- To create an index, use the `createIndex()` method: +> [!IMPORTANT] +> We recommend to create indexes in batches of 3 indexes at a time. +> However, it's highly recommended before creating indexes in production DB to test performance impact on a staging instance with prod-like amount of data. +> +> Previous command should be completed before starting the next batch. ```js -db.getSiblingDB('').getCollection('').createIndex(, ) +db.getSiblingDB('').runCommand( + { + createIndexes: '', + indexes: [ + { ... }, // Index definition from the doc above + { ... }, // Index definition from the doc above + { ... } // Index definition from the doc above + ], + } +) ``` -After executing the `createIndex()` command, you should see a result indicating that the index was created successfully. +After executing the command, you should see a result indicating that the indexes were created successfully. **Index removal** @@ -1568,7 +1583,8 @@ db.getSiblingDB('').getCollection('').dropIndex(' ⚠️ **Important!** In Atlas, for production environments, it is recommended to use rolling index builds by enabling the "Build index via rolling process" checkbox. ([*MongoDB official documentation*](https://www.mongodb.com/docs/v6.0/tutorial/build-indexes-on-replica-sets/)) +> [!IMPORTANT] +> In Atlas, for production environments, it may be recommended to use rolling index builds by enabling the "Build index via rolling process" checkbox. ([*MongoDB official documentation*](https://www.mongodb.com/docs/v7.0/tutorial/build-indexes-on-replica-sets/)) ## Upgrading From 10a420fb843aed119270df7ccab8e6ae6c24fd65 Mon Sep 17 00:00:00 2001 From: Zhenya Tikhonov Date: Sun, 21 Sep 2025 18:55:08 +0400 Subject: [PATCH 3/7] docs: add indexes for 2.9 --- indexes/read-models/accounts.json | 18 ++ indexes/read-models/product-components.json | 170 +++++++++++++++++++ indexes/read-models/product-releases.json | 177 ++++++++++---------- indexes/read-models/promotions.json | 20 +++ 4 files changed, 297 insertions(+), 88 deletions(-) create mode 100644 indexes/read-models/accounts.json create mode 100644 indexes/read-models/product-components.json create mode 100644 indexes/read-models/promotions.json diff --git a/indexes/read-models/accounts.json b/indexes/read-models/accounts.json new file mode 100644 index 000000000..316467710 --- /dev/null +++ b/indexes/read-models/accounts.json @@ -0,0 +1,18 @@ +[ + { + "key": { + "gitopsUsage.cronRunId": 1 + }, + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false + } + } +] diff --git a/indexes/read-models/product-components.json b/indexes/read-models/product-components.json new file mode 100644 index 000000000..1dc869a45 --- /dev/null +++ b/indexes/read-models/product-components.json @@ -0,0 +1,170 @@ +[ + { + "key": { + "favorites": 1 + }, + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false + } + }, + { + "key": { + "application.release.application.prs.type": 1 + }, + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false + } + }, + { + "key": { + "application.release.application.issues.type": 1 + }, + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false + } + }, + { + "key": { + "application.self.name": 1 + }, + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false + } + }, + { + "key": { + "application.self.name": 1, + "application.self.kind": 1, + "application.self.namespace": 1, + "application.self.group": 1, + "application.self.version": 1 + }, + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false + } + }, + { + "key": { + "application.self.name": 1, + "accountId": 1, + "type": 1, + "application.runtime": 1, + "application.self.group": 1, + "application.self.version": 1, + "application.self.kind": 1, + "application.self.cluster": 1, + "application.self.namespace": 1 + }, + "unique": true, + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false + } + }, + { + "key": { + "accountId": 1, + "application.deployedTo.name": 1, + "application.deployedTo.server": 1, + "application.deployedTo.namespace": 1, + "application.runtime": 1 + }, + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false + } + }, + { + "key": { + "accountId": 1, + "application.status.health": 1 + }, + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false + } + }, + { + "key": { + "accountId": 1, + "application.release.appVersions.appVersion": 1 + } + }, + { + "key": { + "accountId": 1, + "application.runtime": 1, + "application.deployedTo.namespace": 1, + "application.deployedTo.name": 1 + } + }, + { + "key": { + "accountId": 1, + "application.runtime": 1, + "application.deployedTo.namespace": 1, + "application.deployedTo.server": 1 + } + } +] diff --git a/indexes/read-models/product-releases.json b/indexes/read-models/product-releases.json index 94b7dc76f..22f5db330 100644 --- a/indexes/read-models/product-releases.json +++ b/indexes/read-models/product-releases.json @@ -1,95 +1,96 @@ [ - { - "key": { - "status": 1 - }, - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + { + "key": { + "accountId": 1, + "productName": 1 }, - { - "key": { - "accountId": 1, - "updatedAt": -1 - }, - "collation": { - "locale": "en", - "caseLevel": false, - "caseFirst": "off", - "strength": 2, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false + } + }, + { + "key": { + "accountId": 1, + "productName": 1, + "status": 1, + "triggerEnvironment": 1, + "triggerCommit.sha": 1 + }, + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false + } + }, + { + "key": { + "accountId": 1, + "productName": 1, + "triggerCommit.sha": 1 }, - { - "key": { - "accountId": 1, - "productName": 1, - "triggerCommit.sha": 1 - }, - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false + } + }, + { + "key": { + "accountId": 1, + "updatedAt": -1 }, - { - "key": { - "accountId": 1, - "productName": 1, - "status": 1, - "triggerEnvironment": 1, - "triggerCommit.sha": 1 - }, - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en", + "caseLevel": false, + "caseFirst": "off", + "strength": 2, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false + } + }, + { + "key": { + "status": 1 }, - { - "key": { - "accountId": 1, - "productName": 1 - }, - "collation": { - "locale": "en_US", - "caseLevel": false, - "caseFirst": "off", - "strength": 1, - "numericOrdering": false, - "alternate": "non-ignorable", - "maxVariable": "punct", - "normalization": false, - "backwards": false, - "version": "57.1" - } + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false } + }, + { + "key": { + "createdAt": 1 + }, + "expireAfterSeconds": 23328000 + } ] diff --git a/indexes/read-models/promotions.json b/indexes/read-models/promotions.json new file mode 100644 index 000000000..8206611d6 --- /dev/null +++ b/indexes/read-models/promotions.json @@ -0,0 +1,20 @@ +[ + { + "key": { + "accountId": 1, + "productName": 1, + "triggerCommit.sha": 1 + }, + "collation": { + "locale": "en_US", + "caseLevel": false, + "caseFirst": "off", + "strength": 1, + "numericOrdering": false, + "alternate": "non-ignorable", + "maxVariable": "punct", + "normalization": false, + "backwards": false + } + } +] From 86c1de0949369dfaf7436c1808b64bfc68050fde Mon Sep 17 00:00:00 2001 From: Zhenya Tikhonov Date: Sun, 21 Sep 2025 19:01:11 +0400 Subject: [PATCH 4/7] doc: document changes in Mongodb schema --- README.md.gotmpl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md.gotmpl b/README.md.gotmpl index 65cd28066..c19c6314c 100644 --- a/README.md.gotmpl +++ b/README.md.gotmpl @@ -2386,6 +2386,15 @@ For built-in RabbitMQ `bitnami/rabbitmq` subchart, pre-upgrade hook was added to - `.Values.runner` is removed +#### Changes in MongoDB schema + +Changes in indexes: follow [Maintaining MongoDB indexes](#maintaining-mongodb-indexes) guide to meet index requirements *before* the upgrade process. + +Changes in collections: following collections can be safely dropped *after* the upgrade to 2.9.x if they exist: + +- `read-models.application-tree` +- `read-models.-history` — every collection with `~-history` suffix, such as `read-models.applications-history`, `read-models.services-history`, etc. + ## Troubleshooting From b666abd22617f40b7c5d628e1b2ddc91520f7e00 Mon Sep 17 00:00:00 2001 From: Zhenya Tikhonov Date: Tue, 23 Sep 2025 13:54:41 +0400 Subject: [PATCH 5/7] docs: generate Readme --- README.md | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 12c905f36..e1219bb04 100644 --- a/README.md +++ b/README.md @@ -1484,7 +1484,8 @@ Use [obtain-oidc-id-token](https://github.com/codefresh-io/steps/blob/822afc0a9a Sometimes, in new releases of Codefresh On-Prem, index requirements change. When this happens, it's mentioned in the [Upgrading section](#upgrading) for the specific release. -> ℹ️ If you're upgrading from version `X` to version `Y`, and index requirements were updated in any of the intermediate versions, you only need to align your indexes with the index requirements of version `Y`. To do that, follow [Index alignment](#index-alignment) instructions. +> [!TIP] +> If you're upgrading from version `X` to version `Y`, and index requirements were updated in any of the intermediate versions, you only need to align your indexes with the index requirements of version `Y`. To do that, follow [Index alignment](#index-alignment) instructions. ### Index alignment @@ -1507,11 +1508,12 @@ indexes **Overview of the index alignment process:** 1. Identify the differences between the indexes in your MongoDB instance and the required index definitions. -2. Create any missing indexes one by one. (It's important not to create them in bulk.) +2. Create any missing indexes. 3. Perform the upgrade of Codefresh On-Prem installation. 4. Then remove any unnecessary indexes. -> ⚠️ **Note! Any changes to indexes should be performed during a defined maintenance window or during periods of lowest traffic to MongoDB.** +> [!IMPORTANT] +> Any changes to indexes should be performed during a defined maintenance window or during periods of lowest traffic to MongoDB.** > > Building indexes during time periods where the target collection is under heavy write load can result in reduced write performance and longer index builds. ([*Source: MongoDB official documentation*](https://www.mongodb.com/docs/manual/core/index-creation/#index-build-impact-on-database-performance)) > @@ -1533,19 +1535,32 @@ mongosh "" db.getSiblingDB('').getCollection('').getIndexes() ``` -- Compare your indexes with the required indexes for the target release, and adjust them by creating any missing indexes or removing any unnecessary ones +- Compare your indexes with the required indexes for the target release, and adjust them by creating any missing indexes or removing any unnecessary ones. **Index creation** -> ⚠ **Note! Always create indexes sequentially, one by one. Don't create them in bulk.** +- To create an indexes, we recommend using the `createIndexes` command ([ref](https://www.mongodb.com/docs/manual/reference/command/createIndexes/)): -- To create an index, use the `createIndex()` method: +> [!IMPORTANT] +> We recommend to create indexes in batches of 3 indexes at a time. +> However, it's highly recommended before creating indexes in production DB to test performance impact on a staging instance with prod-like amount of data. +> +> Previous command should be completed before starting the next batch. ```js -db.getSiblingDB('').getCollection('').createIndex(, ) +db.getSiblingDB('').runCommand( + { + createIndexes: '', + indexes: [ + { ... }, // Index definition from the doc above + { ... }, // Index definition from the doc above + { ... } // Index definition from the doc above + ], + } +) ``` -After executing the `createIndex()` command, you should see a result indicating that the index was created successfully. +After executing the command, you should see a result indicating that the indexes were created successfully. **Index removal** @@ -1559,7 +1574,8 @@ db.getSiblingDB('').getCollection('').dropIndex(' ⚠️ **Important!** In Atlas, for production environments, it is recommended to use rolling index builds by enabling the "Build index via rolling process" checkbox. ([*MongoDB official documentation*](https://www.mongodb.com/docs/v6.0/tutorial/build-indexes-on-replica-sets/)) +> [!IMPORTANT] +> In Atlas, for production environments, it may be recommended to use rolling index builds by enabling the "Build index via rolling process" checkbox. ([*MongoDB official documentation*](https://www.mongodb.com/docs/v7.0/tutorial/build-indexes-on-replica-sets/)) ## Upgrading @@ -2360,6 +2376,15 @@ For built-in RabbitMQ `bitnami/rabbitmq` subchart, pre-upgrade hook was added to - `.Values.runner` is removed +#### Changes in MongoDB schema + +Changes in indexes: follow [Maintaining MongoDB indexes](#maintaining-mongodb-indexes) guide to meet index requirements *before* the upgrade process. + +Changes in collections: following collections can be safely dropped *after* the upgrade to 2.9.x if they exist: + +- `read-models.application-tree` +- `read-models.-history` — every collection with `~-history` suffix, such as `read-models.applications-history`, `read-models.services-history`, etc. + ## Troubleshooting ### Error: Failed to validate connection to Docker daemon; caused by Error: certificate has expired From ccbc8d81da72c8594fb496289de3b860d33e8d5d Mon Sep 17 00:00:00 2001 From: Zhenya Tikhonov Date: Tue, 23 Sep 2025 13:57:32 +0400 Subject: [PATCH 6/7] docs: improve docs --- README.md | 2 +- README.md.gotmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e1219bb04..3502ab128 100644 --- a/README.md +++ b/README.md @@ -2380,7 +2380,7 @@ For built-in RabbitMQ `bitnami/rabbitmq` subchart, pre-upgrade hook was added to Changes in indexes: follow [Maintaining MongoDB indexes](#maintaining-mongodb-indexes) guide to meet index requirements *before* the upgrade process. -Changes in collections: following collections can be safely dropped *after* the upgrade to 2.9.x if they exist: +Changes in collections: following collections can be safely dropped *after* the upgrade to 2.9.x if they exist. These collections are no longer used and should be removed to maintain optimal database performance and prevent the accumulation of obsolete data. - `read-models.application-tree` - `read-models.-history` — every collection with `~-history` suffix, such as `read-models.applications-history`, `read-models.services-history`, etc. diff --git a/README.md.gotmpl b/README.md.gotmpl index c19c6314c..61d985c7a 100644 --- a/README.md.gotmpl +++ b/README.md.gotmpl @@ -2390,7 +2390,7 @@ For built-in RabbitMQ `bitnami/rabbitmq` subchart, pre-upgrade hook was added to Changes in indexes: follow [Maintaining MongoDB indexes](#maintaining-mongodb-indexes) guide to meet index requirements *before* the upgrade process. -Changes in collections: following collections can be safely dropped *after* the upgrade to 2.9.x if they exist: +Changes in collections: following collections can be safely dropped *after* the upgrade to 2.9.x if they exist. These collections are no longer used and should be removed to maintain optimal database performance and prevent the accumulation of obsolete data. - `read-models.application-tree` - `read-models.-history` — every collection with `~-history` suffix, such as `read-models.applications-history`, `read-models.services-history`, etc. From ae6ad3781081dc42ec5482944fe50670f124885e Mon Sep 17 00:00:00 2001 From: Zhenya Tikhonov Date: Wed, 24 Sep 2025 17:46:51 +0400 Subject: [PATCH 7/7] docs: improve index docs --- README.md | 5 ++--- README.md.gotmpl | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5d5ecde3d..6e53c3836 100644 --- a/README.md +++ b/README.md @@ -1501,10 +1501,9 @@ The required index definitions for each release can be found at the following re - `2.6` - `2.7` - `2.8` +- `2.9` -The indexes are stored in JSON files with keys and options specified. - -The directory structure is: +The indexes specifications are stored in JSON files. The directory structure is: ```console indexes diff --git a/README.md.gotmpl b/README.md.gotmpl index 75f62e75e..8b010a486 100644 --- a/README.md.gotmpl +++ b/README.md.gotmpl @@ -1509,10 +1509,9 @@ The required index definitions for each release can be found at the following re - `2.6` - `2.7` - `2.8` +- `2.9` -The indexes are stored in JSON files with keys and options specified. - -The directory structure is: +The indexes specifications are stored in JSON files. The directory structure is: ```console indexes