diff --git a/release-content/0.14/release-notes/11535_Query_Joins.md b/release-content/0.14/release-notes/11535_Query_Joins.md index 1333ed77b7..6c8c8bb282 100644 --- a/release-content/0.14/release-notes/11535_Query_Joins.md +++ b/release-content/0.14/release-notes/11535_Query_Joins.md @@ -1 +1,15 @@ -TODO +Queries can now be combined, returning the data for entities that are contained in both queries. + +```rust +fn helper_function(a: &mut Query<&A>, b: &mut Query<&B>){ + let a_and_b: QueryLens<(Entity, &A, &B)> = a.join(b); + assert!(a_and_b.iter().len() <= a.len()); + assert!(a_and_b.iter().len() <= b.len()); +} +``` + +In most cases, you should continue to simply add more parameters to your original query: `Query<&A, &B>` will generally be clearer than joining them later. +But when a complex system or helper function backs you into a corner, query joins are there if you need them. + +If you're familiar with database terminology, this is an ["inner join"](https://www.w3schools.com/sql/sql_join.asp). +Other types of query joins are on the metaphorical table: please consider taking a crack at the [follow-up issue](https://github.com/bevyengine/bevy/issues/13633). diff --git a/release-content/0.14/release-notes/_release-notes.toml b/release-content/0.14/release-notes/_release-notes.toml index 9c4c4bb503..ff7db4f7e8 100644 --- a/release-content/0.14/release-notes/_release-notes.toml +++ b/release-content/0.14/release-notes/_release-notes.toml @@ -54,7 +54,7 @@ file_name = "11989_Implement_the_AnimationGraph_allowing_for_multiple_animati.md [[release_notes]] title = "Query Joins" -authors = ["@hymm", "@alice-i-cecile"] +authors = ["@hymm"] url = "https://github.com/bevyengine/bevy/pull/11535" file_name = "11535_Query_Joins.md"