Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how do i query against nested properties? #39

Open
neonstalwart opened this issue Jun 25, 2014 · 6 comments
Open

how do i query against nested properties? #39

neonstalwart opened this issue Jun 25, 2014 · 6 comments

Comments

@neonstalwart
Copy link
Member

my first thought was to try a dot-separated path

q = new Query().eq('user.id', id);

but the only way i've found to work is to use an array of path segments

q = new Query().eq(['user', 'id'], id);

should the dot-separated path work or is the array the right way?

@wshager
Copy link
Contributor

wshager commented Jun 25, 2014

What about slash separated? That should be converted to an array.

@neonstalwart
Copy link
Member Author

oh right... i had forgotten slashes was actually what i had expected should work based on reading the parser code and tests. nothing but an array of the segments works - i tried ., ,, /.

@wshager
Copy link
Contributor

wshager commented Jun 26, 2014

It says return "(" + slashed.replace(/\//g, ",") + ")"; so I think (user,id) should be parsed out as well. But it isn't clear that a query string is treated differently then a constructed object.

@neonstalwart
Copy link
Member Author

parsing isn't used when constructing via Query

@wshager
Copy link
Contributor

wshager commented Jun 26, 2014

IMO this is an inconsistency that needs to be addressed. I think property names should be treated the same when constructing an object. So q.eq('this/is/a/path','value') should be parsed out. I don't see a reason not to.

@wshager
Copy link
Contributor

wshager commented Jun 26, 2014

At least it should be documented........

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants