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

Find Query with $in array of ObjectId's #216

Closed
neerajincaendo opened this issue Sep 26, 2017 · 1 comment
Closed

Find Query with $in array of ObjectId's #216

neerajincaendo opened this issue Sep 26, 2017 · 1 comment

Comments

@neerajincaendo
Copy link

hook.app.service('books').find({query: {$in:{members:[userId]}} )

its giving 0 results , userId is Mongoid in schema , do i need to cast userId into ObjectId or something else is the problem , what's the solution , ASAP

@daffl
Copy link
Member

daffl commented Sep 26, 2017

As pointed out in Slack and documented here, the query should be

hook.app.service('books').find({
  query: {
    members: { $in: [ userId ] }
  }
});

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