Hello Fauna folks. My name is Chris and I’m struggling.
I’m trying to retrieve some documents from an index where the string I’m providing startsWith a data property value. I know that’s kind of awkward but it is what it is am I right.
Here’s the index I created.
CreateIndex({
name: "test_persist",
source: Collection("contents"),
terms: [
{
field: ["data", "url"]
}
]
})
So, I figured Filter might be the right approach with the Lamda’ing and all.
Filter(
Index('test_persist'),
Lambda(
'x',
StartsWith('/test/more', Select(['data', 'url'], Get(Var('x')))),
),
)
And right now, you’re chuckling because it looks like I’m just making up stuff, and you are correct, laugh away.
Turns out when you read the docs, filter requires Array, Page or Set as the first argument sooo of course that isn’t going to work. But how do I change the Index into an Array, Set or Page, or reference those within an Index?
This is me pulling the car over and asking for directions. My ex would be so proud.