我正在使用 typegoose 创建模型。在创建模型期间,我发现可以提供集合名称。但是一旦分配,我无法找到修改它的方法。
export const MyModel: ModelType<MyModel> = new MyModel().setModelForClass(MyModel, {
existingMongoose: mongoose,
schemaOptions: {collection: 'my_collection_name'}
});
所以在上面MyModel
,我想更改我正在导入的集合名称。
如何更改模型中的集合名称?还是我只能选择在我想使用的地方创建这个模型?