overleaf/services/web/scripts/project-tokens/deactivate_projects.js
Jakob Ackermann 018a44eeb5 Merge pull request #3185 from overleaf/jpa-normalize-mongo-imports
[misc] normalize mongo imports

GitOrigin-RevId: ac653d9982e0d36736b90f4c03d4c00be88ea76a
2020-09-25 02:04:20 +00:00

30 lines
585 B
JavaScript

const { db, ObjectId } = require('../../app/src/infrastructure/mongojs')
const Async = require('async')
const projectIds = [
// put ids here
]
Async.eachLimit(
projectIds,
5,
(projectId, cb) => {
db.projects.update(
{ _id: ObjectId(projectId) },
{
$unset: { tokens: 1 },
$set: { publicAccesLevel: 'private' }
},
err => {
if (err) return cb(err)
console.log(`Deactivated tokens for ${projectId}`)
cb()
}
)
},
err => {
if (err) throw err
console.log('>> Done')
process.exit(0)
}
)