On this page

Filtering results

Select all the people/ persons

bangdb> S=>(@p Person:*);RETURN p.name AS name, p.fullname AS FullName
+---------- +-----------------------+
|name     | FullName             |
+----------+------------------------+
|tom        | Tom Hanks           |
+----------+------------------------+
|keanu    | Keanu Reeves     |
+----------+------------------------+
|robert    | Robert Zemeckis  |
+----------+------------------------+
bangdb> S=>(@p Person:*); RETURN COUNT(*) AS People
{
   "count" : 3
}

Select movie title “The Matrix”

bangdb> S=>(Movie:* {title="The Matrix"})
{
   "num_items" : 1,
   "nodes" : [
      "{\"title\":\"The Matrix\",\"released\":1997,\"label\":\"Movie\",\"name\":\"matrix\",\"_pk\":\"889565392:7007891359330926487\",\"_v\":1}"
   ]
}

BangDB allows conditions to be also defined for filtering data, such that movie released > 2000

bangdb> S=>(@p Person:*)-[@r ACTED_IN]->(@m Movie:* {released> 2000}); RETURN p.fullname AS FullName, r.roles AS Roles, m.title AS Title
+-------------+----------------+----------------+
| FullName | Roles          |      Title        |
+-------------+----------------+----------------+
| Tom Hanks | ["Zachry"] | Cloud Atlas |
+-------------+----------------+----------------+

Or in json

{
   "rows" : [
      {
         "Title" : "Cloud Atlas",
         "Roles" : "[\"Zachry\"]",
         "FullName" : "Tom Hanks"
      }
   ]
}
Was this article helpful to you? Yes No