@@ -497,6 +497,8 @@ public override TProjection FindOneAndUpdate<TProjection>(IClientSessionHandle s
497
497
Ensure . IsNotNull ( session , nameof ( session ) ) ;
498
498
Ensure . IsNotNull ( filter , nameof ( filter ) ) ;
499
499
Ensure . IsNotNull ( update , nameof ( update ) ) ;
500
+
501
+ options ??= new FindOneAndUpdateOptions < TDocument , TProjection > ( ) ;
500
502
if ( update is PipelineUpdateDefinition < TDocument > && ( options . ArrayFilters != null && options . ArrayFilters . Any ( ) ) )
501
503
{
502
504
throw new NotSupportedException ( "An arrayfilter is not supported in the pipeline-style update." ) ;
@@ -517,6 +519,7 @@ public override Task<TProjection> FindOneAndUpdateAsync<TProjection>(IClientSess
517
519
Ensure . IsNotNull ( session , nameof ( session ) ) ;
518
520
Ensure . IsNotNull ( filter , nameof ( filter ) ) ;
519
521
Ensure . IsNotNull ( update , nameof ( update ) ) ;
522
+ options ??= new FindOneAndUpdateOptions < TDocument , TProjection > ( ) ;
520
523
if ( update is PipelineUpdateDefinition < TDocument > && ( options . ArrayFilters != null && options . ArrayFilters . Any ( ) ) )
521
524
{
522
525
throw new NotSupportedException ( "An arrayfilter is not supported in the pipeline-style update." ) ;
@@ -1030,7 +1033,6 @@ private FindOneAndUpdateOperation<TProjection> CreateFindOneAndUpdateOperation<T
1030
1033
UpdateDefinition < TDocument > update ,
1031
1034
FindOneAndUpdateOptions < TDocument , TProjection > options )
1032
1035
{
1033
- options = options ?? new FindOneAndUpdateOptions < TDocument , TProjection > ( ) ;
1034
1036
var renderArgs = GetRenderArgs ( ) ;
1035
1037
var projection = options . Projection ?? new ClientSideDeserializationProjectionDefinition < TDocument , TProjection > ( ) ;
1036
1038
var renderedProjection = projection . Render ( renderArgs with { RenderForFind = true } ) ;
0 commit comments