Kallol Medhi
Kallol Medhi

Reputation: 589

how to query hstore in typeorm?

I have stored the following object in hstore data type in Postgres

"verified": { "dob": "true", "name": "false", "email": "true" },

How can i query where "dob" = "true"?

Upvotes: 1

Views: 858

Answers (1)

noam steiner
noam steiner

Reputation: 4444

You can write the clause as a string:

this.yourEntityRepository.find({ where: "verified -> 'dob' = TRUE" })

or

this.yourEntityRepository.createQueryBuilder().where("verified -> 'dob' = TRUE").getMany()

Upvotes: 3

Related Questions