surrealdb/surrealdb.js

Feature: RecordId class should error if passing a RecordId as parameter

vitorTheDev opened this issue · 0 comments

Is your feature request related to a problem?

When upgranding from surreal.js 0.x.x to 1.x.x, it's common to cast string parameters as RecordId class. However, some of those values already come as a RecordId, causing mistakes in casting the recordId twice e.g.

new RecordId('table', new RecordId('table', 'id'))

This, instead of proper errors, causes weird behavior in surrealdb.

Describe the solution

The class creation should fail if the id or table parameters are instanceof RecordId with a proper error.

Alternative methods

OR maybe it should parse it correctly.

SurrealDB version

1.4.2 for windows on x86_64

SurrealDB.js version

1.0.0-beta.4

Contact Details

netd777@gmail.com

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct