項目開發中遇到一種情況:
1、字段屬性為數組string[]可傳多值
2、mongodb中字段類型為數組
3、查詢數據:傳入值必須同時在數據庫中存在 ,其中key是字段名
db.getCollection('demo').find({"key": {$all:['30854','12345']}})
代碼:查詢單值 all或is均可
criteriaPlatformId.andOperator(new Criteria("platform_id_list").is("['ALL']"));
代碼:查詢多值 all
criteriaPlatformId.andOperator(new Criteria("platform_id_list").all("['30854','12345']"));