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

Add 'dot' can-set prop to make Mongo style property queries easy #47

Closed
nlundquist opened this issue Apr 11, 2017 · 2 comments
Closed

Comments

@nlundquist
Copy link
Contributor

nlundquist commented Apr 11, 2017

As discussed in donejs/donejs#900 MongoDB gives special significance to queries where a nested object is provided, this does a match against the entire nested object rather match against the individual properties of the nested object.

To match against the individual properties of a nested object you have to pass query parameters using 'dot notation' i.e {"address.city":"Chicago"} instead of {address:{city:"Chicago"}}. To support this in can-set you need to add a set comparator for each nested property you query like this. This comparator has to pick the specified nested property out of the set member and do a comparison to the query parameter without assuming which argument will be the query parameter and which will be the set member.

To make adding comparators like that easy we'll be adding a new can-set prop set.prop.dot to be used like:
set.prop.dot example

@phillipskevin
Copy link
Contributor

Should we call this dotNotation? I think it might make it a little more clear thanset.props.dot.

@nlundquist
Copy link
Contributor Author

Released in can-set 1.2.0

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