项目开发中遇到一种情况:

    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']"));

相关文章:

  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-17
  • 2021-04-08
  • 2022-12-23
猜你喜欢
  • 2022-01-09
  • 2022-12-23
  • 2021-11-23
  • 2021-08-08
  • 2021-04-26
  • 2021-08-28
相关资源
相似解决方案