fix: version schema ref error (#5518)

This commit is contained in:
Archer
2025-08-22 11:34:46 +08:00
committed by GitHub
parent 95325346ff
commit b6318aa35a
4 changed files with 8 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
import { connectionMongo, getMongoModel, type Model } from '../../../common/mongo';
const { Schema, model, models } = connectionMongo;
import { connectionMongo, getMongoModel } from '../../../common/mongo';
const { Schema } = connectionMongo;
import { type AppVersionSchemaType } from '@fastgpt/global/core/app/version';
import { chatConfigType } from '../schema';
import { AppCollectionName, chatConfigType } from '../schema';
import { TeamMemberCollectionName } from '@fastgpt/global/support/user/team/constant';
export const AppVersionCollectionName = 'app_versions';
@@ -15,7 +15,7 @@ const AppVersionSchema = new Schema(
},
appId: {
type: Schema.Types.ObjectId,
ref: AppVersionCollectionName,
ref: AppCollectionName,
required: true
},
time: {
@@ -41,11 +41,7 @@ const AppVersionSchema = new Schema(
}
);
try {
AppVersionSchema.index({ appId: 1, time: -1 });
} catch (error) {
console.log(error);
}
AppVersionSchema.index({ appId: 1, _id: -1 });
export const MongoAppVersion = getMongoModel<AppVersionSchemaType>(
AppVersionCollectionName,