ContainsPath
|
This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics. |
ContainsPath(path, in )
contains_path(path, in )
ContainsPath( path, in )
ContainsPath( path, in )
ContainsPath( path, in )
ContainsPath(path, in )
Description
The ContainsPath function returns true if the specified path exists
within the result of the in expression, or false otherwise.
ContainsPath is useful when you need to distinguish between objects,
arrays, or documents that contain a nested path and those that do not.
The path is an array containing path selectors. Each path selector is
a number (representing an array offset) or a string (representing a field
name). The path is evaluated from left to right, and each path selector
after the first represents a nesting within the data structure of the
result of the in expression.
For example, if you provide the path 0, a, 1, b, the result of the
in expression has to be an array where the first item is an object
with the field a, whose value is an array and the second item in that
array is an object with the field b. The minimal structure that would
satisfy that path is:
[
{
"a": [
{},
{ "b": true }
]
}
]
Parameters
| Parameter | Type | Definition and Requirements |
|---|---|---|
|
Array of Numbers and/or Strings |
A path to a specified field or array entry within the |
|
Any |
A value of any type. |
Examples
-
Array offsets
The following query returns
truebecause the path1, 2(targeting the valuec) exists within the provided array:trueTruetrueBooleanV(True)truetrue -
Field names
The following query returns
truebecause the pathb, twoexists because the provided object has abfield that contains an object with thetwofield:trueTruetrueBooleanV(True)truetrue -
Mixing field names and array offsets
The following query returns
truebecause the path2, first(which refers to the field containingGrace) exists in the provided array:trueTruetrueBooleanV(True)truetrue