Replies: 1 comment
-
you have 2 options:
The 2nd option doesn't support ranges but you can do this: can('read', 'Type', { arrayField: { $size: 2 } });
can('read', 'Type', { arrayField: { $size: 3 } });
can('read', 'Type', { arrayField: { $size: 4 } }); This means that user can read Type if its arrayField's length between 2 and 4 inclusively |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am trying to add a rule using MongoDB conditions to check if an array is greater or less than a specific number.
I have done several tests, the first one being that the field is greater than the number:
This won't work because it checks the value, not the size.
I then tried using $expr and $where, but I can't find a way to implement it.
Our way to do the is:
We load the rule definition from db and use it this way. The rule definition is:
and we create the ability:
Thank you, and if you need more information, please let me know.
Beta Was this translation helpful? Give feedback.
All reactions