Skip to content

Commit 3ba2494

Browse files
committed
CSHARP-1376: Distinct should not send a null value for the query field.
1 parent a9be63b commit 3ba2494

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/MongoDB.Driver.Legacy/MongoCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public IEnumerable<TValue> Distinct<TValue>(DistinctArgs args)
280280
var valueSerializer = (IBsonSerializer<TValue>)args.ValueSerializer ?? BsonSerializer.LookupSerializer<TValue>();
281281
var operation = new DistinctOperation<TValue>(_collectionNamespace, valueSerializer, args.Key, GetMessageEncoderSettings())
282282
{
283-
Filter = new BsonDocumentWrapper(args.Query),
283+
Filter = args.Query == null ? null : new BsonDocumentWrapper(args.Query),
284284
MaxTime = args.MaxTime,
285285
};
286286

0 commit comments

Comments
 (0)