I am writing query JSON data in sequelize.js using postgres db.
Postgres table structure
id: integer,
name: string,
data: json
Here is my data structure
{
id: 3,
name: "v4th79j"
data: {
phone: "123456789",
email: "[email protected]",
password: "$2a$10$qCttQ8leMPCzJfE",
company_id: 2
}
}
I am writing query like this
var filter = {};
// Filter by email for a user
filter.where = { data: { email: "[email protected]"} } ;
Entity.findOne(filter)
.then(function (entity) {
console.log(JSON.stringify(entity))
});
but it is not working. How to find object in JSON datatype?