반응형 개발 프레임워크/Mongoose, TypeGoose2 [Typegoose] 하위 개체의 _id를 없애는 방법, @prop({ _id: false}) Typegoose에서 하위 개체의 _id를 없애는 방법은 @prop({ _id: false})이다. 예시 클래스의 구성은 다음과 같다.export class UserInfo { @ApiProperty({ type: Date }) @IsDateString() @IsOptional() @prop() playTime?: Date; @prop({ type: () => userStrongInfo, _id: false }) @ApiProperty() @IsDefined() @Type(() => userStrongInfo) public userPower: userStrongInfo; @prop({ type: () => userBaseInfo, _id: false }) @ApiProperty({ .. 2023. 3. 3. [Mongoose] strictQuery란? (Strict, Implicit $in) strictQuery, Strict와 차이점, strictQuery 옵션 종류, Implicit $in strictQuery란?Mongoose는 쿼리 필터에 대한 strict 모드를 피하기 위해 별도의 strictQuery 옵션을 지원한다.빈 쿼리 필터로 인해 Mongoose가 모델의 모든 문서를 반환하여 문제가 발생할 수 있기 때문이다.const mySchema = new Schema({ field: Number }, { strict: true });const MyModel = mongoose.model('Test', mySchema);MyModel.find({ notInSchema: 1 });문제점: Mongoose는 'strict: true' 때문에 'notInSchema: 1'을 필터링합니다. .. 2023. 3. 2. 이전 1 다음 반응형