overleaf/services/web/scripts/project-tokens/deactivate_projects.js
nate stemen 9cc5dc968c Merge pull request #1957 from overleaf/ns-decaf-cleanup
.../js/... -> .../src/...

GitOrigin-RevId: ab509c633529440f05247d19c320ebb77d506768
2019-07-11 18:55:42 +00:00

31 lines
609 B
JavaScript

const mongojs = require('../../app/src/infrastructure/mongojs')
const { db, ObjectId } = 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)
}
)