20201106094956_active-projects-index-with-id.mjs 544 B

123456789101112131415161718192021222324252627
  1. import Helpers from './lib/helpers.mjs'
  2. const tags = ['server-ce', 'server-pro', 'saas']
  3. const index = {
  4. key: { _id: 1, lastOpened: 1, active: 1 },
  5. name: '_id_1_lastOpened_1_active_1',
  6. partialFilterExpression: {
  7. active: true,
  8. },
  9. }
  10. const migrate = async client => {
  11. const { db } = client
  12. await Helpers.addIndexesToCollection(db.projects, [index])
  13. }
  14. const rollback = async client => {
  15. const { db } = client
  16. await Helpers.dropIndexesFromCollection(db.projects, [index])
  17. }
  18. export default {
  19. tags,
  20. migrate,
  21. rollback,
  22. }