36 lines
851 B
TypeScript
36 lines
851 B
TypeScript
import { MongoClient } from 'mongodb'
|
|
import * as dotenv from 'dotenv'
|
|
|
|
dotenv.config()
|
|
|
|
const MONGODB_URI = process.env.MONGODB_URI
|
|
|
|
if (!MONGODB_URI) {
|
|
console.error('Please define the MONGODB_URI environment variable in .env')
|
|
process.exit(1)
|
|
}
|
|
|
|
async function giveBetaToAll() {
|
|
let client: MongoClient | null = null;
|
|
try {
|
|
client = await MongoClient.connect(MONGODB_URI!)
|
|
const db = client.db('pummmpfun')
|
|
|
|
console.log(`Giving BETA status to ALL users...`)
|
|
|
|
const result = await db.collection('users').updateMany(
|
|
{},
|
|
{ $set: { isBetaTester: true } }
|
|
)
|
|
|
|
console.log(`Updated count: ${result.modifiedCount}`)
|
|
console.log(`Matched count: ${result.matchedCount}`)
|
|
|
|
} catch (error) {
|
|
console.error('Error:', error)
|
|
} finally {
|
|
if (client) await client.close()
|
|
}
|
|
}
|
|
|
|
giveBetaToAll()
|