mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
24 lines
485 B
JavaScript
24 lines
485 B
JavaScript
|
const mongojs = require('../../app/js/infrastructure/mongojs')
|
||
|
const { db } = mongojs
|
||
|
|
||
|
const keys = { 'tokens.readAndWritePrefix': 1 }
|
||
|
const opts = {
|
||
|
unique: true,
|
||
|
partialFilterExpression: {
|
||
|
'tokens.readAndWritePrefix': { $exists: true }
|
||
|
},
|
||
|
background: true
|
||
|
}
|
||
|
|
||
|
console.log(
|
||
|
`>> Creating index on ${JSON.stringify(keys)}, ${JSON.stringify(opts)}`
|
||
|
)
|
||
|
|
||
|
db.projects.createIndex(keys, opts, err => {
|
||
|
if (err) {
|
||
|
throw err
|
||
|
}
|
||
|
console.log('>> done')
|
||
|
process.exit(0)
|
||
|
})
|