You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm updating my code base from surrealdb.js version 0.11.1 to surrealdb version 1.0.0-beta.20 and running into a snag. I have this query which returns the expected result set, whether I run it in Surrealist.app:
SELECT VALUE <-belongs_to_model_schema<-entity_schema AS e FROM model_schema WHERE id in $modelSchemaIds FETCH e
or using the 0.11.1 SDK:
const modelSchemaIds = ['model_schema:x'];
const response = await this.query('SELECT VALUE <-belongs_to_model_schema<-entity_schema AS e FROM model_schema WHERE id in $modelSchemaIds FETCH e', { modelSchemaIds });
However, when I attempt this query using SDK 1.0.0-beta.20, I'm getting an empty result set!
Steps to reproduce
See description
Expected behaviour
I'd expect to get the same results that I was getting for SDK version 0.11.1.
Figured it out (sort of): It's not processing the query bindings properly. If I change the query call from this:
const modelSchemaIds = ['model_schema:x'];
const response = await this.query('SELECT VALUE <-belongs_to_model_schema<-entity_schema AS e FROM model_schema WHERE id IN $modelSchemaIds FETCH e', { modelSchemaIds });
to this:
const modelSchemaIds = ['model_schema:x'];
const response = await this.query(`SELECT VALUE <-belongs_to_model_schema<-entity_schema AS e FROM model_schema WHERE id IN [${modelSchemaIds.map(modelSchemaId => `"${modelSchemaId}"`).join(', ')}] FETCH e`, { modelSchemaIds });
then I get the expected results.
lylejohnson
changed the title
Bug: Query returns no results
Bug: Query bindings for array-valued bindings broken
Aug 22, 2024
Also works if I map them to StringRecordId instances:
const modelSchemaIds = ['model_schema:x'];
const response = await this.query(
'SELECT VALUE <-belongs_to_model_schema<-entity_schema AS e FROM model_schema WHERE id IN $modelSchemaIds FETCH e',
{
modelSchemaIds.map(modelSchemaId => new StringRecordId(modelSchemaId)
}
);
Still broken in v1.1.0. surreal.query('select ->friends->user.* from only $auth;') returns records in the nested response object. surreal.query('select value ->friends->user.* from only $auth;') returns no records. Running this query against the DB (in Surrealist) returns the expected records.
Describe the bug
I'm updating my code base from
surrealdb.js
version 0.11.1 tosurrealdb
version 1.0.0-beta.20 and running into a snag. I have this query which returns the expected result set, whether I run it in Surrealist.app:or using the 0.11.1 SDK:
However, when I attempt this query using SDK 1.0.0-beta.20, I'm getting an empty result set!
Steps to reproduce
See description
Expected behaviour
I'd expect to get the same results that I was getting for SDK version 0.11.1.
SurrealDB version
surreal 1.5.4 for linux on x86_64
JavaScript SDK version
0.0.1-beta.20
Contact Details
[email protected]
Is there an existing issue for this?
Code of Conduct
The text was updated successfully, but these errors were encountered: