Skip to content

Commit 2c5cc36

Browse files
author
rstam
committed
CSHARP-797: Don't allow null as the WriteConcern passed to the Execute method.
1 parent c8678c1 commit 2c5cc36

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

MongoDB.Driver/Operations/BulkWriteOperation.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,16 @@ internal BulkWriteOperation(MongoCollection collection, bool isOrdered)
3737

3838
// public methods
3939
/// <summary>
40-
/// Executes the bulk operation.
40+
/// Executes the bulk operation using the default write concern from the collection.
4141
/// </summary>
4242
/// <returns>A BulkWriteResult.</returns>
4343
public BulkWriteResult Execute()
4444
{
45-
return Execute(null);
45+
var args = new BulkWriteArgs
46+
{
47+
IsOrdered = _isOrdered
48+
};
49+
return _collection.BulkWrite(args, _requests);
4650
}
4751

4852
/// <summary>
@@ -52,6 +56,10 @@ public BulkWriteResult Execute()
5256
/// <returns>A BulkWriteResult.</returns>
5357
public BulkWriteResult Execute(WriteConcern writeConcern)
5458
{
59+
if (writeConcern == null)
60+
{
61+
throw new ArgumentNullException("writeConcern");
62+
}
5563
var args = new BulkWriteArgs
5664
{
5765
IsOrdered = _isOrdered,

0 commit comments

Comments
 (0)