Merge pull request #21668 from overleaf/jpa-mongo-utils

[mongo-utils] create new home for batchedUpdate helper

GitOrigin-RevId: 9f61c5e367a9f4cef63b5cc4c0bbbd3ef57c8ca8
This commit is contained in:
Jakob Ackermann
2024-11-08 09:07:09 +00:00
committed by Copybot
parent a3d8caf87b
commit 252533b2fd
23 changed files with 96 additions and 355 deletions
@@ -1,11 +1,11 @@
import mongodb from 'mongodb-legacy'
import { promiseMapWithLimit } from '@overleaf/promise-utils'
import BatchedUpdateModule from './helpers/batchedUpdate.mjs'
import { batchedUpdate } from '@overleaf/mongo-utils/batchedUpdate.js'
import ChatApiHandler from '../app/src/Features/Chat/ChatApiHandler.js'
import DeleteOrphanedDataHelper from './delete_orphaned_data_helper.mjs'
import { ensureMongoTimeout } from './helpers/env_variable_helper.mjs'
import { db } from '../app/src/infrastructure/mongodb.js'
const { batchedUpdate } = BatchedUpdateModule
const { ObjectId } = mongodb
const { getHardDeletedProjectIds } = DeleteOrphanedDataHelper
@@ -86,7 +86,7 @@ async function main() {
_id: 1,
project_id: 1,
}
await batchedUpdate('rooms', {}, processBatch, projection)
await batchedUpdate(db.rooms, {}, processBatch, projection)
console.log('Final')
console.log(RESULT)
}