Add indices to Check model

This commit is contained in:
Alex Holliday
2024-12-28 09:34:27 -08:00
parent 319e6d6017
commit 91e7229b23

View File

@@ -67,5 +67,8 @@ const BaseCheckSchema = mongoose.Schema({
*/
const CheckSchema = mongoose.Schema({ ...BaseCheckSchema.obj }, { timestamps: true });
CheckSchema.index({ createdAt: 1 });
CheckSchema.index({ monitorId: 1, createdAt: 1 });
CheckSchema.index({ monitorId: 1, createdAt: -1 });
export default mongoose.model("Check", CheckSchema);
export { BaseCheckSchema };