ITADN

Documentation: error in record references example

#1454Opennickchomey 创建于 2025-10-11
documentation
N
nickchomeycommented
### Description This line seems to be out of date, as i think the `references` type was removed with the new `<~` graph syntax introduced in https://github.com/surrealdb/surrealdb/pull/6273 https://github.com/surrealdb/docs.surrealdb.com/blob/3ca36ddf2e54380a69ed3d61c43884a62724b030/src/content/doc-surrealql/datamodel/references.mdx?plain=1#L129-L141 But I also notice that the output from that example is just wrong. The output in the docs matches what I get for an actual query, but it doesn't match what it should be: ``` [ { borrowed_by: [ person:one, person:two ], id: comic_book:one, owned_by: [ person:one, person:two ], title: 'Loki, God of Stories' } ] ``` Why are both people being listed in borrowed and owned? It should only be one in each. The issue seems to be that in the prior implementation (and documentation) we specified not just person, but the field that was being referred to ```sql DEFINE FIELD owned_by ON comic_book TYPE references<person, comics>; DEFINE FIELD borrowed_by ON comic_book TYPE references<person, borrowed_comics>; ``` Without that, the references seem to just apply at a table-level. If we use those lines (instead of `<~`) in v2 of surrealdb, the results are as-expected. ```js [ { borrowed_by: [ person:two ], id: comic_book:one, owned_by: [ person:one ], title: 'Loki, God of Stories' } ] ``` Is there a way to specifying something like `<~<person, comics>`? https://surrealdb.com/docs/surrealql/datamodel/references#specifying-linking-tables ### 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
10 条评论