overleaf/services/web/migrations/20240618125145_cleanup_user_features_templates.mjs
Jakob Ackermann 252533b2fd Merge pull request #21668 from overleaf/jpa-mongo-utils
[mongo-utils] create new home for batchedUpdate helper

GitOrigin-RevId: 9f61c5e367a9f4cef63b5cc4c0bbbd3ef57c8ca8
2024-11-08 09:07:09 +00:00

20 lines
433 B
JavaScript

import { db } from '../app/src/infrastructure/mongodb.js'
import { batchedUpdate } from '@overleaf/mongo-utils/batchedUpdate.js'
const tags = ['server-ce', 'server-pro', 'saas']
const migrate = async () => {
await batchedUpdate(
db.users,
{ 'features.templates': { $exists: true } },
{ $unset: { 'features.templates': true } }
)
}
const rollback = async () => {}
export default {
tags,
migrate,
rollback,
}