I have a problem regarding using surrealdb.js on the server and having to send data from the server to the client. I want to send the RecordId of an record to the client in a JSON format instead of a tb:id-string. Though when trying to do this, i stumble upon the following problems:
It is not possible to send classes from server to client.
When using jsonify, the RecordId is converted into a string of the form tb:id.
Therefore, i have no simple way of returning data from the server to the client while maintaining the JSON-object in the recordId.
Describe the solution
It would be nice to have a utility function or a method implemented on the class that could convert the recordId class into JSON and maintain the JSON-structure:
Heya! You should be able to simply obtain the id part by selecting the id property from the RecordId. The jsonify utility simply outputs the JSON-like value that SurrealDB would
Is your feature request related to a problem?
I have a problem regarding using surrealdb.js on the server and having to send data from the server to the client. I want to send the RecordId of an record to the client in a JSON format instead of a
tb:id
-string. Though when trying to do this, i stumble upon the following problems:jsonify
, the RecordId is converted into a string of the formtb:id
.Therefore, i have no simple way of returning data from the server to the client while maintaining the JSON-object in the recordId.
Describe the solution
It would be nice to have a utility function or a method implemented on the class that could convert the recordId class into JSON and maintain the JSON-structure:
Alternative methods
Write my own utility function, or also store the data elsewhere than in the recordId.
SurrealDB version
surreal 1.5.3
SurrealDB.js version
1.0.0-beta-12
Contact Details
olavnon@gmail.com
Is there an existing issue for this?
Code of Conduct