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

Query nested properties #10

Closed
juncoding opened this issue Dec 15, 2016 · 4 comments
Closed

Query nested properties #10

juncoding opened this issue Dec 15, 2016 · 4 comments

Comments

@juncoding
Copy link

juncoding commented Dec 15, 2016

I'm not sure it's a bug or a new feature, but the behavior is not same as loopback find/findOne.

=== Sample Code ===

var applyFilter = require('loopback-filters');
var data = [
    {foo: [{name: 'bar'}, {name: 'bar2'}]},
    {bat: [{name: 'baz'}]},
    {foo: [{name: 'bar'}]}
];
var filter = {where: {"foo.name": 'bar'}};
var filtered = applyFilter(data, filter);
console.log(filtered);

=== Expected result ===

[ {foo: [{name: 'bar'}, {name: 'bar2'}] }, { foo: [{name: 'bar'} ]

=== Actual result ===

[]

but I use loopback model.find/findOne, I can get expected result.

Please help. Thanks.

@bajtos
Copy link
Member

bajtos commented Dec 14, 2017

I think you are looking for support for querying nested properties, which was added to loopback-datasource-juggler (and thus find/findOne methods) via loopbackio/loopback-datasource-juggler#1239 and possibly other pull requests related to strongloop/loopback#517.

Ideally, loopback-datasource-juggler's memory connector would be using loopback-filters under the hood and there was only a single place where to add support for new filtering features. Unfortunately we haven't had bandwidth to do that change, and as a result loopback-filters is always behind loopback capabilities. Any volunteers to contribute this change?

As a short-term workaround, we can always port loopbackio/loopback-datasource-juggler#1239 (and other related pull requests) from juggler to this module. We don't have bandwidth for this task ourselves, but we are happy to help you if you decide to contribute this feature.

@bajtos bajtos changed the title Filter not support array value? Query nested properties Dec 14, 2017
@bajtos bajtos added the feature label Dec 14, 2017
@bajtos
Copy link
Member

bajtos commented Dec 14, 2017

I created a new issue in juggler to keep track of the work of using loopback-filters under the hood: loopbackio/loopback-datasource-juggler#1529

@stale
Copy link

stale bot commented Nov 12, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 12, 2019
@stale
Copy link

stale bot commented Nov 26, 2019

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

@stale stale bot closed this as completed Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants