-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 3.4.0
-
Component/s: Query Operations
-
None
When I execute the command db.getCollection("collname").distinct("fieldname"); on a collection that contains a document like
{ "_id": "...", "fieldname": null }
Exception in thread "main" java.lang.IllegalArgumentException: The value for key value can not be null at org.bson.BsonDocument.put(BsonDocument.java:721) at org.bson.BsonDocument.<init>(BsonDocument.java:83) at com.mongodb.DBCollection$1.apply(DBCollection.java:1185) at com.mongodb.DBCollection$1.apply(DBCollection.java:1182) at com.mongodb.MappingIterable$1.apply(MappingIterable.java:53) at com.mongodb.OperationIterable.forEach(OperationIterable.java:73) at com.mongodb.MappingIterable.forEach(MappingIterable.java:50) at com.mongodb.MappingIterable.into(MappingIterable.java:60) at com.mongodb.DBCollection.distinct(DBCollection.java:1189) at com.mongodb.DBCollection.distinct(DBCollection.java:1161) at com.mongodb.DBCollection.distinct(DBCollection.java:1136) at com.mongodb.DBCollection.distinct(DBCollection.java:1124) at DbBugTest.main(DbBugTest.java:13)