-
-
Notifications
You must be signed in to change notification settings - Fork 256
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
toMongoQuery #30
Comments
Yes, it could be. But this function doesn't do optimisation. It just follows the general rule: all regular rules are OR-ed. So, in your case you have only 1 rules that's why they are identical. It's possible to optimise this if it's important for you. Just to check if |
thanks for quick response, so if it will be |
No, // this is equivalent of
// (a === 1 && b === 2 ) || c === 3
{
$or: [{ a: 1, b: 2 }, { c: 3 }]
} Update: so in your case it will be the same as |
I see, ok thanks, that work for me |
You are welcome! :) |
lets say I have a rule:
can('read', ['products'], { tid: 'someId' })
then when I'm using:
toMongoQuery(rules)
it returns
{ '$or': [ { tid: 'someId' } ] }
, shouldn't it just be{ tid: 'someId' }
?The text was updated successfully, but these errors were encountered: