瀏覽代碼

add index to page

Yuki Takei 2 年之前
父節點
當前提交
00dbefbb42
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      apps/app/src/server/models/page.ts

+ 3 - 0
apps/app/src/server/models/page.ts

@@ -153,6 +153,9 @@ const schema = new Schema<PageDocument, PageModel>({
   toJSON: { getters: true },
   toObject: { getters: true },
 });
+// indexes
+schema.index({ createdAt: 1 });
+schema.index({ updatedAt: 1 });
 // apply plugins
 schema.plugin(mongoosePaginate);
 schema.plugin(uniqueValidator);