Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoDB - FindOne / Find doesn't work with @DeleteDateColumn() #9250

Closed
crossinghoods opened this issue Jul 29, 2022 · 1 comment · Fixed by #9262
Closed

MongoDB - FindOne / Find doesn't work with @DeleteDateColumn() #9250

crossinghoods opened this issue Jul 29, 2022 · 1 comment · Fixed by #9262

Comments

@crossinghoods
Copy link

Issue Description

Find, FindBy, FindOne, FindOneBy all do not work properly when @DeleteDateColumn() is used

DB: MongoDB
Typescript 4.7.4
Typeorm 0.3.7

Create a few entries with different names, try to find 1 entry by using
await VenueSVG.find({ where: { name: "test-7" } });
await VenueSVG.findOne( { name: "test-7" } );

Expected Behavior

Should result in getting entries where name == "test-7"

Actual Behavior

  • Returns the 1st entry when using findOne()
  • Returns all entries when using find()

Steps to Reproduce

`export class VenueSVG extends BaseEntity {
@ObjectIdColumn()
id!: ObjectID;

@column()
name!: string;

@DeleteDateColumn()
deletedDate!: Date;
}
`

  1. Create a few entries i.e. "test-1", "test-2" etc.
  2. Use the find methods await VenueSVG.find({ where: { name: "test-7" } }); Or await VenueSVG.findOne( { name: "test-7" } );
@roseline124
Copy link
Contributor

roseline124 commented Aug 5, 2022

I've been through same issue. I'll try this job!
If you need to work with DeleteDateColumn right now in typeorm@^0.3.0, you can do like this (but this is temporary solution. it will return deleted data)

VenueSvg.findOne({where: { name: "test-7"}, withDeleted: true})

or you'd better to downgrade typeorm version to 0.2.41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants