Skip to content

Commit

Permalink
added indexes suggested by atlas
Browse files Browse the repository at this point in the history
  • Loading branch information
Giovanni Troisi committed Nov 29, 2024
1 parent e86d60a commit fef942f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions models/kb_setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ var KBSettingSchema = new Schema({


KBSchema.index({ createdAt: -1, updatedAt: -1 })
KBSchema.index({ id_project: 1, namespace: 1, updatedAt: -1 })


// DEPRECATED
const KBSettings = mongoose.model('KBSettings', KBSettingSchema);
Expand Down
9 changes: 7 additions & 2 deletions models/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,14 +492,19 @@ RequestSchema.index({ id_project: 1, createdAt: 1, preflight: 1});
//suggested by atlas profiler. Used by auto closing requests
RequestSchema.index({ hasBot: 1, status: 1, createdAt: 1});

// Evaluate following indexes
// suggested by atlas
RequestSchema.index({ "channel.name": 1, id_project: 1, preflight: 1, "snapshot.requester.uuid_user": 1, createdAt: - 1, status: 1 })
RequestSchema.index({ id_project: 1, preflight: 1, "snapshot.agents.id_user": 1, updatedAt: -1, draft: 1, status: 1 })
RequestSchema.index({ id_project: 1, participants: 1, preflight: 1, updatedAt: -1, draft: 1, status: 1 })
RequestSchema.index({ id_project: 1, preflight: 1, updatedAt: -1, draft: 1, status: 1 })
RequestSchema.index({ id_project: 1, preflight: 1, "snapshot.requester.uuid_user": 1, createdAt: -1, status: 1 })
RequestSchema.index({ department: 1, id_project: 1, participants: 1, preflight: 1, createdAt: -1, status: 1 })

RequestSchema.index({ id_project: 1, preflight: 1, createdAt: -1, status: 1 });
RequestSchema.index({ id_project: 1, preflight: 1, createdAt: 1 })
RequestSchema.index({ participants: 1, id_project: 1, createdAt: -1, status: 1 })
RequestSchema.index({ id_project: 1, "snapshot.lead.email": 1, createdAt: -1, status: 1 })
RequestSchema.index({ id_project: 1, participants: 1, "snapshot.agents.id_user": 1, createdAt: -1, status: 1 })
RequestSchema.index({ id_project: 1, createdAt: -1, status: 1 })

// cannot index parallel arrays [agents] [participants] {"driv
// RequestSchema.index({ id_project: 1, status: 1, preflight:1, participants:1, "agents.id_user":1, updatedAt: -1 }); //NN LO APPLICA
Expand Down

0 comments on commit fef942f

Please sign in to comment.