back_fill_hiding_ai_features.mjs 693 B

1234567891011121314151617181920212223242526272829303132
  1. import { db } from '../../app/src/infrastructure/mongodb.mjs'
  2. import { batchedUpdate } from '@overleaf/mongo-utils/batchedUpdate.js'
  3. import { scriptRunner } from '../lib/ScriptRunner.mjs'
  4. async function main(trackProgress) {
  5. // update all applicable user models
  6. await batchedUpdate(
  7. db.users,
  8. {
  9. 'writefull.enabled': false,
  10. },
  11. {
  12. $set: {
  13. 'aiErrorAssistant.enabled': false,
  14. },
  15. },
  16. undefined,
  17. undefined,
  18. { trackProgress }
  19. )
  20. console.log('completed syncing writefull state with error assist')
  21. }
  22. export default main
  23. try {
  24. await scriptRunner(main)
  25. process.exit(0)
  26. } catch (error) {
  27. console.error({ error })
  28. process.exit(1)
  29. }