INNER CODE UNIT · JavaScript
targetExists
furey/mongodb-lens · mongodb-lens.js:1827
const targetExists = collections.some(c => c.name === newName)
if (!targetExists || dropTarget !== 'true' || config.disableDestructiveOperationTokens) {
const result = await renameCollection(oldName, newName, dropTarget === 'true')
return {
content: [{
type: 'text',
text: `Collection '${oldName}' renamed to '${newName}' successfully.`
}]
}
}
if (token) {
if (!validateRenameCollectionToken(oldName, newName, dropTarget, token)) {
throw new Error(`Invalid or expired confirmation token. Please try again without a token to generate a new confirmation code.`)
}
const result = await renameCollection(oldName, newName, true)
return {