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

Ability to query nested documents/objects/arrays #953

Closed
faridnsh opened this issue Dec 26, 2014 · 9 comments
Closed

Ability to query nested documents/objects/arrays #953

faridnsh opened this issue Dec 26, 2014 · 9 comments
Labels

Comments

@faridnsh
Copy link
Contributor

For example right now there doesn't seem to be an easy way to have equivalent of this mongodb query with loopback where filters:

{
    people : {
        $elemMatch : {
            id : ObjectId('546047f6118d30f014000001'),
            tags : { $in : ['alive'], $ne : 'rich' }
        }
    }
}

Do note that poeple is an array of objects that contains, tags which is an array of strings.

Note that this has been asked before on mailing list and on stackoverflow.

@fabien
Copy link
Contributor

fabien commented Jan 8, 2015

With the PR in place, the above query should work as follows:

{
    people : {
        elemMatch : {
            id : '546047f6118d30f014000001',
            tags : { in : ['alive'], ne : 'rich' }
        }
    }
}

It might have worked before, but not if you defined the people property as:

people: { type: [Person] }

@bajtos
Copy link
Member

bajtos commented Feb 23, 2015

This is possibly a duplicate of #517.

@arealmaas
Copy link

+1 for support in the memory-connector aswell!

@kennethlynne
Copy link

Yeah what @AlmaasAre said!

For testing purposes

@eugenehp
Copy link

hey @bajtos can you advise what is the best place in source code to start tickling this feature?
I saw 6+ months of support at #517 and looks like I'm going to need this in couple of my productions...

so what would be your advise to implement this so it might get a chance to be merged to master branch.

Thanks. 👍

@bajtos
Copy link
Member

bajtos commented Oct 15, 2015

@eugenehp

can you advise what is the best place in source code to start tickling this feature?
I saw 6+ months of support at #517 and looks like I'm going to need this in couple of my productions...

so what would be your advise to implement this so it might get a chance to be merged to master branch

@raymondfeng @fabien do you have any thoughts on how to implement support for querying nested documents/objects/arrays? I am not familiar enough with this part of loopback to give a good advice.

@eugenehp
Copy link

thanks @bajtos
I'm particularly going to be interested to implement solution on top of the mongodb connector first, and then possibly MySQL.

Since you guys @raymondfeng @fabien have more experience with your code, please advise on the best way to pursue this.

Thank you.

Have a nice weekend ahead!

@pthieu
Copy link

pthieu commented Nov 3, 2016

@eugenehp: Have you made any progress on this: https://github.com/strongloop/loopback-datasource-juggler/pull/1083/files allows this functionality but only for arrays and may provide some insight on now to implement for objects.

There's also #517, which is an ongoing discussion on filtering level 2 properties. Will close this issue if no response since it's been over a year.

@loay
Copy link
Contributor

loay commented Mar 14, 2017

@eugenehp Nested query is currently working with Mongodb. Please have a look at it.
I am closing this issue in favor of #517

@loay loay closed this as completed Mar 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests