Skip to main content

FindConnection

Find all connections that satisfy the specified constraints.

Parameters​

  • [optional] with_class: Name of the class for the connection.

  • [optional] _ref: Identifier assigned to the results of this command for later use in the transaction.

  • [optional] unique: Indicates whether a single connection is expected to satisfy the constraints.

  • [optional] src: Reference to the object that is the source of the connection.

  • [optional] dst: Reference to the object that is the destination of the connection.

  • [optional] constraints

  • [optional] sort

  • [optional] offset

  • [optional] limit

  • [optional] batch

  • [optional] results

  • [optional] uniqueids

  • [optional] group_by_source: Group matching connections by the objects referenced by src and/or dst. When both are provided, each connection is included in the groups for both endpoints. Requires src or dst when enabled.

  • [optional] per_group: Apply sorting, offset, and limit independently within each source group. Requires group_by_source when enabled.

Use text search expressions inside constraints for fuzzy or full-text matching, and an explicit sort expression for relevance ordering.

Examples​

Count the number of connections of class “HasVisited”:

[{
"FindConnection": {
"with_class": "HasVisited",
"results": {
"count": true
}
}
}]

Count the number of connections of class “HasVisited” that an Entity of the class “Patient” has, where the Entity of class “Patient” is the source of the Connection, and retrieve the “date” and “care_taker” properties of the Connection. Sort the results by date:

[{
"FindEntity": {
"with_class": "Patient",
"_ref": 1,
"constraints": ["$patient_id", "==", 231]
}
}, {
"FindConnection": {
"with_class": "HasVisited",
"src": 1,
"sort": "date",
"results": {
"count": true,
"list": ["date", "care_taker"]
}
}
}]