mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Add auxiliary Mongo cluster support for library collections GitOrigin-RevId: 1cfdbe4bbeb6c95f1158834ae60a4e34bef7bb87
33 lines
720 B
JavaScript
33 lines
720 B
JavaScript
import Helpers from './lib/helpers.mjs'
|
|
|
|
const tags = ['saas', 'auxiliary']
|
|
|
|
const indexes = [
|
|
{
|
|
key: { userId: 1, searchKey: 1 },
|
|
name: 'userId_1_searchKey_1',
|
|
collation: { locale: 'en', strength: 1 },
|
|
},
|
|
{
|
|
key: { userId: 1, 'fields.searchValue': 1, 'fields.name': 1 },
|
|
name: 'userId_1_fields.searchValue_1_fields.name_1',
|
|
collation: { locale: 'en', strength: 1 },
|
|
},
|
|
]
|
|
|
|
const migrate = async client => {
|
|
const { db } = client
|
|
await Helpers.addIndexesToCollection(db.libraryReferences, indexes)
|
|
}
|
|
|
|
const rollback = async client => {
|
|
const { db } = client
|
|
await Helpers.dropIndexesFromCollection(db.libraryReferences, indexes)
|
|
}
|
|
|
|
export default {
|
|
tags,
|
|
migrate,
|
|
rollback,
|
|
}
|