Exception when geting distinct values of a field from Mongo collection using mongo Java Driver 3.0
问题 I'm getting distinct values of field from mongodb. When i run the following query in the commandline, it works good. db.celldata.distinct("tenentId") I'm using Mongo java 3.0 driver, to retrieve the distinct values using the following query MongoCursor<String> iterator = coll.distinct("tenantId", String.class).iterator(); When i run the query i get the following exception org.bson.BsonInvalidOperationException: readString can only be called when CurrentBSONType is STRING, not when