@@ -474,12 +474,19 @@ BsonDocument getDistinctResult(final BsonDocument collectionOptions, final BsonD
474
474
@ SuppressWarnings ("deprecation" )
475
475
BsonDocument getFindOneResult (final BsonDocument collectionOptions , final BsonDocument arguments ,
476
476
@ Nullable final ClientSession clientSession ) {
477
- return getFindResult (collectionOptions , arguments , clientSession );
477
+ FutureResultCallback <BsonDocument > futureResultCallback = new FutureResultCallback <BsonDocument >();
478
+ createFindIterable (collectionOptions , arguments , clientSession ).first (futureResultCallback );
479
+ return toResult (futureResult (futureResultCallback ));
478
480
}
479
481
480
482
@ SuppressWarnings ("deprecation" )
481
483
BsonDocument getFindResult (final BsonDocument collectionOptions , final BsonDocument arguments ,
482
484
@ Nullable final ClientSession clientSession ) {
485
+ return toResult (createFindIterable (collectionOptions , arguments , clientSession ));
486
+ }
487
+
488
+ private FindIterable <BsonDocument > createFindIterable (final BsonDocument collectionOptions , final BsonDocument arguments ,
489
+ @ Nullable final ClientSession clientSession ) {
483
490
FindIterable <BsonDocument > iterable ;
484
491
if (clientSession == null ) {
485
492
iterable = getCollection (collectionOptions ).find (arguments .getDocument ("filter" , new BsonDocument ()));
@@ -505,7 +512,7 @@ BsonDocument getFindResult(final BsonDocument collectionOptions, final BsonDocum
505
512
if (arguments .containsKey ("collation" )) {
506
513
iterable .collation (getCollation (arguments .getDocument ("collation" )));
507
514
}
508
- return toResult ( iterable ) ;
515
+ return iterable ;
509
516
}
510
517
511
518
BsonDocument getMapReduceResult (final BsonDocument collectionOptions , final BsonDocument arguments ,
0 commit comments