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

When using the 'modelSelector' setting, buildSelector returns circular selector. #49

Closed
ka-miyake opened this issue Oct 25, 2016 · 2 comments
Assignees

Comments

@ka-miyake
Copy link

This filter works.

filter = { where:
  { foo: 'foo' }
};
model.find(filter, (err, rslt) => { /* ... */ }); 

But this doesn't.

filter = { where: { and: [
  { foo: 'foo' },
  { bar: 'bar' }
]}};
model.find(filter, (err, rslt) => { /* ... */ }); 
@jannyHou
Copy link
Contributor

hmm, it works for me:
Use example https://github.com/strongloop/loopback-example-database
Add another property in model Account called branch
With some sample data(see reference), try node . and open explorer:

Endpoint GET/ Account with filter

{"where": {"and": [{"email": "email1"}, {"branch": "branch1"}]}}

Result:

[
  {
    "email": "email1",
    "branch": "branch1",
    "id": "93f63326e1bbe187e10d873620377013"
  },
  {
    "email": "email1",
    "branch": "branch1",
    "id": "93f63326e1bbe187e10d873620376e5b"
  },
  {
    "email": "email1",
    "branch": "branch1",
    "id": "48eb5295643f29caeae9009d2b3719f4"
  }
]

Reference:

[
  {
    "email": "email2",
    "branch": "branch2",
    "id": "c4f513eceaa8647d85fcb99b64294d68"
  },
  {
    "email": "email1",
    "branch": "branch1",
    "id": "93f63326e1bbe187e10d873620377013"
  },
  {
    "email": "email1",
    "branch": "branch1",
    "id": "93f63326e1bbe187e10d873620376e5b"
  },
  {
    "email": "email1",
    "branch": "branch2",
    "id": "bf769780771cbff99efae668242cf8ec"
  },
  {
    "email": "email1",
    "branch": "branch1",
    "id": "48eb5295643f29caeae9009d2b3719f4"
  }
]

@jannyHou
Copy link
Contributor

@ka-miyake It works for me, see my comment in #49 (comment)
If you still run into this issue, please fork https://github.com/strongloop/loopback-sandbox and provide your app to reproduce the error.

I am closing it now, feel free to reopen it with the sandbox. Thanks.

@jannyHou jannyHou self-assigned this Sep 11, 2017
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