diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md b/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md index f55f64fafe..25de31f09d 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md @@ -555,6 +555,20 @@ nebula> MATCH (v1:player{name:"Tim Duncan"}), (v2:team{name:"Spurs"}) \ +----------------------------------------------------+----------------------------------+ ``` +### 匹配最短路径 + +用户可以用 `shortestPath` 表示模式中的路径。 + +``` +nebula> MATCH p = shortestPath((a:player)-[e:follow*..2]-(b:player))\ + WHERE a.player.age > 45 AND b.player.age < 30 \ + RETURN p; ++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| p | ++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| <("player144" :player{age: 47, name: "Shaquille O'Neal"})-[:follow@0 {degree: 80}]->("player100" :player{age: 42, name: "Tim Duncan"})<-[:follow@0 {degree: 99}]-("player113" :player{age: 29, name: "Dejounte Murray"})> | ++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +``` ## 多MATCH检索 不同的模式有不同的筛选条件时,可以使用多`MATCH`,会返回模式完全匹配的行。