MongoTemplate Criteria Query

后端 未结 2 468
小鲜肉
小鲜肉 2021-02-03 13:45

I\'m generating a complicated Mongo query depending on multiple parameters. One of criterion that I want to make with Criteria helper class is:

2条回答
  •  醉话见心
    2021-02-03 14:36

    Query query = new Query(Criteria.where("field1").exists(true).ne(false));
    

    Or, if field1 is always a boolean value when present:

    Query query = new Query(Criteria.where("field1").is(true));
    

提交回复
热议问题