Package org.springframework.data.mongodb

Examples of org.springframework.data.mongodb.InvalidMongoDbApiUsageException


   * @return
   */
  public Criteria is(Object o) {

    if (!isValue.equals(NOT_SET)) {
      throw new InvalidMongoDbApiUsageException(
          "Multiple 'is' values declared. You need to use 'and' with multiple criteria");
    }

    if (lastOperatorWasNot()) {
      throw new InvalidMongoDbApiUsageException("Invalid query: 'not' can't be used with 'is' - use 'ne' instead.");
    }

    this.isValue = o;
    return this;
  }
View Full Code Here


   * @param o the values to match against
   * @return
   */
  public Criteria in(Object... o) {
    if (o.length > 1 && o[1] instanceof Collection) {
      throw new InvalidMongoDbApiUsageException("You can only pass in one argument of type "
          + o[1].getClass().getName());
    }
    criteria.put("$in", Arrays.asList(o));
    return this;
  }
View Full Code Here

  private void setValue(DBObject dbo, String key, Object value) {
    Object existing = dbo.get(key);
    if (existing == null) {
      dbo.put(key, value);
    } else {
      throw new InvalidMongoDbApiUsageException("Due to limitations of the com.mongodb.BasicDBObject, "
          + "you can't add a second '" + key + "' expression specified as '" + key + " : " + value + "'. "
          + "Criteria already contains '" + key + " : " + existing + "'.");
    }
  }
View Full Code Here

    String key = criteriaDefinition.getKey();

    if (existing == null) {
      this.criteria.put(key, criteriaDefinition);
    } else {
      throw new InvalidMongoDbApiUsageException("Due to limitations of the com.mongodb.BasicDBObject, "
          + "you can't add a second '" + key + "' criteria. " + "Query already contains '"
          + existing.getCriteriaObject() + "'.");
    }

    return this;
View Full Code Here

TOP

Related Classes of org.springframework.data.mongodb.InvalidMongoDbApiUsageException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.