back_fill_hiding_ai_features.mjs 559 B

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