Skip to content

Commit

Permalink
perf: add Atlas recommended indices (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeaturner authored Jun 18, 2024
1 parent 66291ba commit a97cf69
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 6 deletions.
14 changes: 12 additions & 2 deletions server/models/book.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,22 @@ BookSchema.index({
summary: "text",
libraryTags: "text",
});

BookSchema.index({
location: 1,
program: 1,
});

BookSchema.index({
subject: 1,
});
BookSchema.index({
publisher: 1,
});
BookSchema.index({
course: 1,
});
BookSchema.index({
libraryTags: 1,
});
const Book = model<BookInterface>("Book", BookSchema);

export default Book;
33 changes: 29 additions & 4 deletions server/models/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,35 @@ const ProjectSchema = new Schema<ProjectInterface>(
);

ProjectSchema.index({ title: "text" });
ProjectSchema.index({members: 1, updatedAt: -1, title: -1, status: 1, projectID: 1})
ProjectSchema.index({leads: 1, updatedAt: -1, title: -1, status: 1, projectID: 1})
ProjectSchema.index({liaisons: 1, updatedAt: -1, title: -1, status: 1, projectID: 1})
ProjectSchema.index({auditors: 1, updatedAt: -1, title: -1, status: 1, projectID: 1})
ProjectSchema.index({
members: 1,
updatedAt: -1,
title: -1,
status: 1,
projectID: 1,
});
ProjectSchema.index({
leads: 1,
updatedAt: -1,
title: -1,
status: 1,
projectID: 1,
});
ProjectSchema.index({
liaisons: 1,
updatedAt: -1,
title: -1,
status: 1,
projectID: 1,
});
ProjectSchema.index({
auditors: 1,
updatedAt: -1,
title: -1,
status: 1,
projectID: 1,
});
ProjectSchema.index({ libreCoverID: 1, libreLibrary: 1, visibility: 1 });

ProjectSchema.virtual("defaultPrimaryAuthor", {
ref: "Author",
Expand Down

0 comments on commit a97cf69

Please sign in to comment.