In fauna language how can I check if a key is present in an object?

For example: I want a way to query a result from a Select statement.

 Select(
          "data",
          Get(Ref(Collection("likes"), "295350577445996038"))
 )

Results:

        {
          "auth|123456": true,
          "auth|123455": true
        }

I can pipe the Select results to a Variable with a Let statement but then I want to check if in the data object a key name is present.

In JavaScript if I do the following I get a true/false value:

"auth|123456" in Results --> true
"unknown" in Results --> false

How can I achieve the same in FQL?

ContainsPath should be helpful: ContainsPath | Fauna Documentation

1 Like