Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

340
Views
TypeORM Typescript: How to ignore case when comparing UUID?

This code bellow:

.findOne({ id: model.userId })!;

does case sensitive comparing. I want to compare UUID with case insensitive.

How can I do this?

I am using MSSQL as the database. It stores GUID in lowercase. But there is a problem, TypeORM always returns Uppercased UUID.

For example:

let application = await applicationRepo.findOne({id: model.id, ownerId: res.locals.owner.id});

Returns this:

{
    "id": "AFB3015E-BE49-EC11-AE4D-74D83E04F9D3",
    "name": ".....",
    "dateCreated": "1637384252132",
    "status": "ACTIVE",
    "ownerId": "96BBB111-BE49-EC11-AE4D-74D83E04F9D3"
}

If possible I want to set and get uuid in lowercase.

How can I do this?


Note

This is the entity example:

@Entity()
export class Application {

    @PrimaryGeneratedColumn("uuid")
    id: string;

    @Column()
    name: string;

    @Column("bigint")
    dateCreated: number;

    @Column()
    status: string;

    @ManyToOne(type => Owner, owner => owner.applications)
    @JoinColumn({ name: "ownerId" })
    owner: Owner;

    @Column()
    ownerId: string;

    @OneToMany(type => User, user => user.application)
    users: User[];

    @OneToMany(type => ChatRoom, chatRoom => chatRoom.application)
    chatRooms: ChatRoom[];
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You could modify it locally by using toLowerCase()

const data = {
    "id": "AFB3015E-BE49-EC11-AE4D-74D83E04F9D3",
    "name": ".....",
    "dateCreated": "1637384252132",
    "status": "ACTIVE",
    "ownerId": "96BBB111-BE49-EC11-AE4D-74D83E04F9D3"
}

const result = { ...data, id: data.id.toLowerCase() };

console.log(result);

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!