When creating a record with as a value a BigInt the JSON.stringify in the send method of the WebSocketStrategy class errors with the following error: TypeError: JSON.stringify cannot serialize BigInt.. Making it impossible to store numbers that need to be BigInt, or else they would get truncated by JS, in the SurrealDB instance.
Also all values retrived by the database also get truncated for the exact same reason
Steps to reproduce
For TypeError: JSON.stringify cannot serialize BigInt.:
Create a Surreal class instance and connect it
Try to insert a document with a bigint somewhere (example: { testBigInt: 452n })
The error will be throwned
For the truncated number received:
Run the following SurQL code in the surreal sql command: CREATE test SET testTruncated = 987654321987654321
Fetch the document with the surreal.js library
The last 2 digits in this case are 0 incorrectly (987654321987654300)
Expected behaviour
For the error: the error doesn't get throw and the value is inserted into the database.
For the truncated values: the value is not truncated
SurrealDB version
surreal 1.0.2 for linux on x86_64
SurrealDB.js version
0.11.0
Contact Details
No response
Is there an existing issue for this?
[X] I have searched the existing issues
Code of Conduct
[X] I agree to follow this project's Code of Conduct
Describe the bug
When creating a record with as a value a BigInt the
JSON.stringify
in thesend
method of theWebSocketStrategy
class errors with the following error:TypeError: JSON.stringify cannot serialize BigInt.
. Making it impossible to store numbers that need to be BigInt, or else they would get truncated by JS, in the SurrealDB instance.Also all values retrived by the database also get truncated for the exact same reason
Steps to reproduce
For
TypeError: JSON.stringify cannot serialize BigInt.
:{ testBigInt: 452n }
)For the truncated number received:
surreal sql
command:CREATE test SET testTruncated = 987654321987654321
surreal.js
libraryExpected behaviour
For the error: the error doesn't get throw and the value is inserted into the database.
For the truncated values: the value is not truncated
SurrealDB version
surreal 1.0.2 for linux on x86_64
SurrealDB.js version
0.11.0
Contact Details
No response
Is there an existing issue for this?
Code of Conduct