如何扩展猫鼬模型以向文档查询添加属性?

时间:2020-06-28 15:31:45

标签: typescript

我将如何扩展DocumeQuery以支持属性{cache:any}

import { model, Schema, Document } from "mongoose";

export interface ILocation extends Document{
  name: string;
  description: string;
}

const response = await model.findById(id).cache(60, 'Location-Cache-Key') // -> Cache on this line.

Property 'cache' does not exist on type 'DocumentQuery<ILocation, ILocation, {}>'

0 个答案:

没有答案