org.springframework.data.mongodb.InvalidMongoDbApiUsageException: Due to limitations of the com.mongodb.BasicDBObject, you can't add a second '$or' expression specified as '$or : [ { “field1” : “value1”}, {“field1” : “value2”}]'. Criteria already contains '$or : [ { “field2” : “value3”} , { “field2” : “value4”}]'.

  1. 0

    Failing to add a second '$or' expression

    Stack Overflow | 5 months ago | Dikshit Luthra
    org.springframework.data.mongodb.InvalidMongoDbApiUsageException: Due to limitations of the com.mongodb.BasicDBObject, you can't add a second '$or' expression specified as '$or : [ { “field1” : “value1”}, {“field1” : “value2”}]'. Criteria already contains '$or : [ { “field2” : “value3”} , { “field2” : “value4”}]'.
  2. 0

    Bad "Or" criteria conversion

    GitHub | 2 years ago | ares242
    org.springframework.data.mongodb.InvalidMongoDbApiUsageException: Due to limitations of the com.mongodb.BasicDBObject, you can't add a second 'null' criteria. Query already contains '{ }'.
  3. 0

    InvalidMongoDbApiUsageException on selecting another item in the table

    GitHub | 2 years ago | christoph-frick
    org.springframework.data.mongodb.InvalidMongoDbApiUsageException: Due to limitations of the com.mongodb.BasicDBObject, you can't add a second '_id' criteria. Query already contains '{ "_id" : { "$oid" : "549062c704a6f3200c141652"}}'.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.springframework.data.mongodb.InvalidMongoDbApiUsageException

      Due to limitations of the com.mongodb.BasicDBObject, you can't add a second '$or' expression specified as '$or : [ { “field1” : “value1”}, {“field1” : “value2”}]'. Criteria already contains '$or : [ { “field2” : “value3”} , { “field2” : “value4”}]'.

      at org.springframework.data.mongodb.core.query.Criteria.setValue()
    2. Spring Data MongoDB - Core
      Criteria.andOperator
      1. org.springframework.data.mongodb.core.query.Criteria.setValue(Criteria.java:640)
      2. org.springframework.data.mongodb.core.query.Criteria.getCriteriaObject(Criteria.java:573)
      3. org.springframework.data.mongodb.core.query.Criteria.createCriteriaList(Criteria.java:630)
      4. org.springframework.data.mongodb.core.query.Criteria.andOperator(Criteria.java:539)
      4 frames