edgedb-js
edgedb-js copied to clipboard
Unable to query link properties from a backlink
Code The code causing the error.
e.select(e.User, user => ({
id: true,
following: e.select(user['<_followers'].is(e.Group), group => {
return {
name: group._name,
note: group['@_note'], // 🚨 throws "Cannot read properties of undefined (reading '__kind__')"
// '@_note': true, // 🚨 throws "cannot select link property '@_note' on an object (default::Group)"
}
}),
}))
Schema
type User {
required property _email -> str {
constraint exclusive;
}
}
type Group {
required property _name -> str {
constraint exclusive;
}
multi link _followers -> User {
property _note -> str;
property _followedAt -> datetime {
default := datetime_current();
};
}
}
Generated EdgeQL The query cannot be generated with the link properties, but WITHOUT them the result of .toEdgeQL is:
WITH
__scope_0_User := DETACHED default::User
SELECT __scope_0_User {
id,
multi following := (
WITH
__scope_1_Group := __scope_0_User.<_followers[IS default::Group]
SELECT __scope_1_Group {
single name := __scope_1_Group._name
}
)
}
Desired behavior
Get the same results as this query.
select User { id, followers := .<_followers[is Group] { name := ._name, note := @_note } }
Versions:
- OS: Ubuntu 20.04 LTS (WSL)
- EdgeDB version: 2.1+c73716f
- edgedb Node.js client version: 0.21.3
Have the same issue. Would love to see this resolved.