mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-29 10:20:59 +00:00
Merge pull request #2821 from overleaf/jpa-ns-replace-spellcheck-languages
[script] add a script to replace all unsupported spell check languages GitOrigin-RevId: 597033b7ae7733f8bc7e5e0f4dfb1a49d0cae3b4
This commit is contained in:
parent
295264697e
commit
cbba4132e1
1 changed files with 50 additions and 0 deletions
50
services/web/scripts/replace_spellcheck_languages.js
Normal file
50
services/web/scripts/replace_spellcheck_languages.js
Normal file
|
@ -0,0 +1,50 @@
|
|||
const { db } = require('../app/src/infrastructure/mongojs')
|
||||
|
||||
const languages = [
|
||||
'am',
|
||||
'hy',
|
||||
'bn',
|
||||
'gu',
|
||||
'he',
|
||||
'hi',
|
||||
'hu',
|
||||
'is',
|
||||
'kn',
|
||||
'ml',
|
||||
'mr',
|
||||
'or',
|
||||
'ss',
|
||||
'ta',
|
||||
'te',
|
||||
'uk',
|
||||
'uz',
|
||||
'zu',
|
||||
'fi'
|
||||
]
|
||||
|
||||
function main(callback) {
|
||||
const query = { spellCheckLanguage: { $in: languages } }
|
||||
db.projects.update(
|
||||
query,
|
||||
{ $set: { spellCheckLanguage: '' } },
|
||||
{ multi: true },
|
||||
(err, result) => {
|
||||
if (err) {
|
||||
return callback(err)
|
||||
}
|
||||
console.log(`>> Updated projects: ${JSON.stringify(result)}`)
|
||||
return callback()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
main(err => {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
return process.exit(1)
|
||||
}
|
||||
console.log('>> done')
|
||||
process.exit(0)
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue