Hey so I am trying to write the following mongoDB using the Java driver:
db.testDB.find( {$and : [ {EntryFee : {"$lte" : 15} }, {EntryFee : {"$gte" : 10} } ] } )
The java code I have looks like this, where minEntryFee and maxEntryFee are both Integers.
if(minEntryFee != null && maxEntryFee != null ){
BasicDBList list = new BasicDBList();
list.add(BasicDBObjectBuilder.start().push("EntryFee").add("$gte", minEntryFee));
list.add(BasicDBObjectBuilder.start().push("EntryFee").add("$lte", maxEntryFee));
builder.add("$and", list);
return builder.get();
}
But when I run this code, I get the following error:
Can't find a codec for class com.mongodb.BasicDBObjectBuilder.] with root cause org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class com.mongodb.BasicDBObjectBuilder.
Any ideas? Thanks.