Reputation: 3213
How can I check if a String is inside:
Set<String> obAccountIDs = new HashSet<String>();
in my User model?
Is the in Criteria method the right approach to use?
Thanks
Upvotes: 1
Views: 5172
Reputation: 151102
Or better to use the $nin operator equivalent:
Criteria.where("obAccountIDs").nin(IDs);
Also noting that $not is a "field specific" operator that is actually only applying to the operator expression and producing the negative. You would not be able to use that "across documents". So $nin
is the better action in both cases, apart from requiring less typing.
Upvotes: 3