Multiple nesting in Falcor query

218 views Asked by At

I am trying to query a multiple nested object with Falcor. I have an user which has beside other the value follower which itself has properties like name.

I want to query the name of the user and the first 10 follower.

My Falcor server side can be seen on GitHub there is my router and resolver.

I query the user with user["KordonDev"]["name", "stars"]. And the follower with user["KordonDev"].follower[0.10]["name", "stars"].

The route for follower is user[{keys:logins}].follower[{integers:indexes}] but this doesn't catch the following query.

I tried to add it as string query. user["KordonDev"]["name", "stars", "follower[0..10].name"] doesn't work.

The second try was to query with arrays of keys. ["user", "KordonDev", "follower", {"from":0, "to":10}, "name"] but here I don't know how to query the name of the user.

1

There are 1 answers

0
FabioCosta On BEST ANSWER

As far as I know and looking on the path parser. There is no way to do nested queries.

What you want to do is batch the query and do two queries.

user["KordonDev"]["name", "stars"]
user["KordonDev"]["follower"][0..10].name

It seems that falcor does not support this, there is even a somewhat old issue discussing how people trying to do nested queries.

to the point about the current syntax leading people to try this:

['lolomo', 0, 0, ['summary', ['item', 'summary']]]

I can see folks trying to do the same thing with the new syntax:

"lolomo[0][0]['summary', 'item.summary']"

As soon as they know they can do:

"lolomo[0][0]['summary', 'evidence']"

So it seems deep nested queries is not a functionality.