////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////

To query with raw Cypher queries you can use the built in `find` and `findAll` methods:

[source,groovy]
----
def club = Club.find("MATCH n where n.name = {1} RETURN n", 'FC Bayern Muenchen')
def clubs = Club.findAll("MATCH n where n.name = {1} RETURN n", 'FC Bayern Muenchen')
----

Note that the first returned item should be the node itself. To execute cypher queries and work with the raw results use `executeCypher`:

[source,groovy]
----
Result result = Club.executeCypher("MATCH n where n.name = {1} RETURN n", ['FC Bayern Muenchen'])
----

Or alternatively you can use `executeQuery` which will return a list of results:

[source,groovy]
----
List<Node> nodes = Club.executeQuery("MATCH n where n.name = {1} RETURN n", ['FC Bayern Muenchen'])
----

When working with raw results, you can convert any `org.neo4j.driver.types.Node` into a domain instance using the `as` keyword:

[source,groovy]
----
Node myNode = ...
 Club club = myNode as Club
----

TIP: This also works for `Relationship` and `Path` types

You can also convert any https://neo4j.com/docs/api/java-driver/4.0/org/neo4j/driver/Result.html[org.neo4j.driver.Result] instance to a list of domain classes:

[source,groovy]
----
Result result = ...
List<Club> clubs = result.toList(Club)
----

