【发布时间】:2018-11-27 08:45:05
【问题描述】:
我正在执行对 Postgre DB 的查询,以获取早于特定日期的数据。
这是我的功能
async filesListToDelete(): Promise<any> {
return await this.fileRepository.find({
where: { last_modified: { $lt: '2018-11-15 10:41:30.746877' } },
});
}
这是我定义文件实体的方式:
export class File {
@PrimaryGeneratedColumn()
id: number;
@Column({ nullable: false })
idFonc: number;
@Column({ nullable: false })
version: number;
@Column('varchar', { length: 100, nullable: false })
filename: string;
@Column({ nullable: true })
last_modified: Date;
@Column({ nullable: false })
device: boolean;
@ManyToOne(type => Type, { nullable: false })
@JoinColumn({ referencedColumnName: 'id' })
type: Type;
@OneToMany(type => FileDevice, filedevice => filedevice.file)
fileDevice: FileDevice[];
}
我收到这个错误
QueryFailedError: invalid input syntax for type timestamp: "{"$lt":"2018-11-15 10:41:30.746877"}"
【问题讨论】:
标签: database mongodb postgresql typeorm typeorm-activerecord