ORM for TypeScript and JavaScript. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.
Geography column types such as geometry, point etc save method returns a hex representation of the geography type in the database, while .find methods return the json representation of it
Expected Behavior
I expect .save with method results to be consistent with what is returned in the find methods. I would like to also get json when i use .save method
Actual Behavior
A hex representation of the geography type is returned.
Steps to reproduce
Given the entity below
import type { Geometry } from "geojson";
@Entity
class MyEntity{
@PrimaryGeneratedColumn()
public id: number;
@Column({
type: "geography",
spatialFeatureType: "Geometry",
srid: 4326,
nullable: true,
default: null,
})
public geometry: Geometry | null;
}
Issue description
Geography column types such as geometry, point etc save method returns a hex representation of the geography type in the database, while .find methods return the json representation of it
Expected Behavior
I expect .save with method results to be consistent with what is returned in the find methods. I would like to also get json when i use .save method
Actual Behavior
A hex representation of the geography type is returned.
Steps to reproduce
Given the entity below
Example usage below with expectation and actual
My Environment
Additional Context
I can see from the tests here that typeorm is aware of this https://github.com/typeorm/typeorm/blob/master/test/functional/spatial/postgres/spatial-postgres.ts#L184. As they assign the value to the result of save.
Relevant Database Driver(s)
Are you willing to resolve this issue by submitting a Pull Request?
No