mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #17294 from overleaf/ii-token-access-null-values-2
[web] Use secondary when fixing token access values in projects GitOrigin-RevId: 2111b20630530e2c8d09120a783c84efe6e976ed
This commit is contained in:
parent
642eea2de6
commit
7130a981b7
1 changed files with 13 additions and 1 deletions
|
@ -3,6 +3,9 @@ const { batchedUpdate } = require('./helpers/batchedUpdate')
|
|||
const { ObjectId } = require('mongodb')
|
||||
const minimist = require('minimist')
|
||||
const CollaboratorsHandler = require('../app/src/Features/Collaborators/CollaboratorsHandler')
|
||||
const {
|
||||
READ_PREFERENCE_SECONDARY,
|
||||
} = require('../app/src/infrastructure/mongodb')
|
||||
|
||||
const argv = minimist(process.argv.slice(2), {
|
||||
string: ['projects'],
|
||||
|
@ -35,9 +38,18 @@ const PROJECTS_LIST = argv.projects
|
|||
|
||||
async function findUserIds() {
|
||||
const userIds = new Set()
|
||||
const cursor = db.users.find({}, { _id: 1 })
|
||||
const cursor = db.users.find(
|
||||
{},
|
||||
{
|
||||
projection: { _id: 1 },
|
||||
readPreference: READ_PREFERENCE_SECONDARY,
|
||||
}
|
||||
)
|
||||
for await (const user of cursor) {
|
||||
userIds.add(user._id.toString())
|
||||
if (userIds.size % 1_000_000 === 0) {
|
||||
console.log(`=> ${userIds.size} users added`, new Date().toISOString())
|
||||
}
|
||||
}
|
||||
console.log(`=> User ids count: ${userIds.size}`)
|
||||
return userIds
|
||||
|
|
Loading…
Reference in a new issue