import { Document, ObjectId, Schema } from 'mongoose'
import { IApprenticeProjectApplicationDocument } from './apprenticeprojectapplications'
import { IProjectDocument } from './project'
import { IUserDocument } from './user'
import { IWorkspaceDocument } from './workspace'
export interface ICompanyDocument extends Document {
_id: string
name: string
address: string
phone: string
email: string
onBoardingType: string
contactUser: ObjectId | IUserDocument
onBoardingUser: ObjectId | IUserDocument
workSpace: ObjectId | IWorkspaceDocument
postedProjects: ObjectId | IProjectDocument
engagedProjects: ObjectId | IApprenticeProjectApplicationDocument
preference: string
}
export const CompanySchema = new Schema<ICompanyDocument>({
name: {
type: String,
},
address: {
type: String,
},
phone: {
type: String,
required: true
},
email: {
type: String,
},
onBoardingType: {
type: String,
},
contactUser: {
ref: 'User',
type: Schema.Types.ObjectId
},
onBoardingUser: {
ref: 'User',
type: Schema.Types.ObjectId
},
workSpace: {
ref: 'Workspace',
type: Schema.Types.ObjectId
},
postedProjects: {
ref: 'Project',
type: Schema.Types.ObjectId
},
engagedProjects: {
ref: 'ApprenticeProjectApplication',
type: Schema.Types.ObjectId
},
});
*上面的代码我们如何转换为 TypeORM 我在将猫鼬类转换为 TypeORM 时遇到问题。TypeORM 与 MongoDB。我如何在 mongodb 中使用 typeORM 我如何在 mongodb 中使用 typeORM 我如何在 mongodb 中使用 typeORM 我如何在 mongodb 中使用 typeORM 我如何在 mongodb 中使用 typeORM *