Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
文字列が内部にあるかどうかを確認するにはどうすればよいですか:
Set<String> obAccountIDs = new HashSet<String>();
私のユーザーモデルで?
in Criteria メソッドは使用する正しいアプローチですか?
Spring Mongo クエリ ドキュメント
ありがとう
または、同等の$nin演算子を使用することをお勧めします。
Criteria.where("obAccountIDs").nin(IDs);
また、$notは「フィールド固有の」演算子であり、実際には演算子式にのみ適用され、否定を生成することに注意してください。それを「ドキュメント間」で使用することはできません。タイピング$ninの必要性を除けば、どちらの場合もより良いアクションです。
$nin
はい、そうです。
Criteria.where("obAccountIDs").not().in(IDs);