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 + "'.");
}
}