Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Set indexes on most used queries #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions apps/fillForm/server/dbSetup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {Tasks} from "/imports/model/tasks";


export const setIndexes = () => {
Tasks.createIndex({
"journal.lastSeen": 1,
"journal.submittedAt": 1,
"variables.assigneeSciper": 1,
"variables.phdStudentSciper": 1,
"variables.programAssistantSciper": 1,
"variables.doctoralProgramName": 1
}, {
name: 'users listing their own tasks'
})

Tasks.createIndex({
"journal.lastSeen": 1,
"variables.assigneeSciper": 1,
"journal.submittedAt": 1
}, {
name: 'maybe admin listing all tasks'
})

Tasks.createIndex({
"_id": 1,
"journal.submittedAt": 1
}, {
name: 'to assert task for a user is not already submitted'
})
}
2 changes: 2 additions & 0 deletions apps/fillForm/server/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import './methods/ImportScipers'
import './methods/TaskForm'
import './methods/ZeebeProcessInstance'
import './publish'
import {setIndexes} from "/server/dbSetup";
import WorkersClient from './zeebe_broker_connector'
import { PrometheusSource } from '/server/prometheus'
import Tequila from 'meteor/epfl:accounts-tequila'
Expand All @@ -15,6 +16,7 @@ require("dotenv").config({path: findUpSync(".env")})


Meteor.startup(() => {
setIndexes();

// add custom methods for the devs
if (Meteor.isDevelopment) {
Expand Down