It’s not the definition that contains 1 element, it is what is returned from the Map
function. Since you are using Map
to get the Documents, it is those Documents that will be passed to the Filter
.
You should be able to refactor to pass just the Document to the Filter
, and use Let
to take the values that you need.
Filter(
Map(
Paginate(
Intersection(
Match(Index("by_room_type"), "single"),
Match(Index("by_room_size"), "big")
)
),
Lambda("ref", Get(q.Var("ref")))
),
Lambda(
["doc"],
Let(
{
ref: Select("ref", Var("doc")),
ts: Select("ts", Var("doc")),
data: Select("data", Var("doc"))
},
Equals(Select("Price", Var("data")), "£700")
)
)
)
alternatively
You could return an array of what you want from the Map
Filter(
Map(
Paginate(
Intersection(
Match(Index("by_room_type"), "single"),
Match(Index("by_room_size"), "big")
)
),
Lambda(
"ref",
Let(
{
doc: Get(Var("ref")),
},
[
Select("ref", Var("doc")),
Select("ts", Var("doc")),
Select("data", Var("doc"))
]
)
)
),
Lambda(
["ref", "ts", "data"],
Equals(Select("Price", Var("data")), "£700")
)
)