overleaf/services/web/scripts/project-tokens/add_readAndWritePrefix_index.js
nate stemen 9cc5dc968c Merge pull request #1957 from overleaf/ns-decaf-cleanup
.../js/... -> .../src/...

GitOrigin-RevId: ab509c633529440f05247d19c320ebb77d506768
2019-07-11 18:55:42 +00:00

23 lines
486 B
JavaScript

const mongojs = require('../../app/src/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)
})