Query syntax - sociam/indx GitHub Wiki

Query Syntax for INDX

$or

e.g.

{ "$or": [
    { "name": "Daniel Smith"
    },
    { "name": "Max van Kleek"
    },
  ]
}

Returns any nodes that have a name of Daniel Smith OR a name of Max van Kleek.

$and

e.g.

{ "$and": [
    { "name": "Daniel Smith"
    },
    { "name": "Max van Kleek"
    },
  ]
}

Returns any nodes that have a name of Daniel Smith AND a name of Max van Kleek.

Direct Matching Predicate/Values

List the predicate and a value to ensure that the result matches it.

e.g.

{ "name": "Daniel Smith"
}

Returns all nodes that have name of Daniel Smith.

Can be a sub-query part under $OR or $AND.

Sub-Predicate Matching Predicate/Values

List the predicate and a value to ensure that the result matches it.

e.g.

{ "name": "Daniel Smith",
    "friend": {
        "name": "Max van Kleek"
    }
}

Returns all nodes that have name of Daniel Smith and have a friend with a name of Max van Kleek.

Can be a sub-query part under $OR or $AND and/or a direct match.

Numeric Operator Matching Predicate/Values

Numerically match a value under a predicate via an operator.

Operators available are:

"$gt": ">"
"$lt": "<"
"$ge": ">="
"$le": "<="

Where the keys (e.g. $gt) are used in INDX querying, and correspond to the respective mathematical operator.

e.g.

{ "age": {
    "$gt": 20 
  }
}

Will match all nodes where there is an age with a value greater than 20.