object converted automatically with toString()
See original GitHub issueIssue type:
[X] question [ ] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql
/ mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[X] react-native
[ ] expo
TypeORM version:
[x] latest
[ ] @next
[ ] 0.x.x
(or put your version here)
Steps to reproduce or a small repository showing the problem:
I have item data with LatLng coordinate pairs stored in a column, and it comes back from my API in JSON format: item: {id: 3, latlngs: {lat: 123, lng: 456}
I have tried to use the @BeforeInsert()
method to convert the column data with JSON.stringify(latlngs)
but this isn’t being processed accordingly, and i keep getting the yellowbox.js error in the console with the message:
addStatement - parameter of type <object> converted to string using toString()
I had this working before by manually extracting the item data via a flatMap()
and transforming each individual item’s latlng via JS via JSON.stringify()
but I am unsure how to inject this behavior when I am doing cascading inserts for these entities.
any guidance/help would be greatly appreciated! this ORM is fantastic and I am enjoying and greatly benefiting from using it thus far, thank you to all the maintainers and developers on this project!
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
(a comment for future references, who searched for this error)
In
react-native-sqlite-storage: ^6.0.1
, I experience this:Solved by this:
Example code (Solution):