INNER CODE UNIT · JavaScript

indexExists

furey/mongodb-lens · mongodb-lens.js:2222

          const indexExists = indexes.some(idx => idx.name === indexName)

          if (!indexExists) {
            throw new Error(`Index '${indexName}' does not exist on collection '${collection}'`)
          }

          const newToken = storeDropIndexToken(collection, indexName)
          return {
            content: [{
              type: 'text',
              text: `⚠️ PERFORMANCE IMPACT WARNING ⚠️\n\nYou've requested to drop the index '${indexName}' from collection '${collection}'.\n\nDropping this index may impact query performance. To confirm, type the 4-digit confirmation code EXACTLY as shown below:\n\nConfirmation code: ${newToken}\n\nThis code will expire in 5 minutes for security purposes.\n\n${importantNoticeToAI}`
            }]
          }
        }, `Error processing index drop for '${indexName}' on collection '${collection}'`)
      }
    )
  }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…