@@ -379,176 +379,11 @@ public void Dispose()
379
379
}
380
380
}
381
381
382
- public CursorBatch < TDocument > Query < TDocument > (
383
- CollectionNamespace collectionNamespace ,
384
- BsonDocument query ,
385
- BsonDocument fields ,
386
- IElementNameValidator queryValidator ,
387
- int skip ,
388
- int batchSize ,
389
- bool secondaryOk ,
390
- bool partialOk ,
391
- bool noCursorTimeout ,
392
- bool tailableCursor ,
393
- bool awaitData ,
394
- IBsonSerializer < TDocument > serializer ,
395
- MessageEncoderSettings messageEncoderSettings ,
396
- CancellationToken cancellationToken )
397
- {
398
- #pragma warning disable 618
399
- return Query (
400
- collectionNamespace ,
401
- query ,
402
- fields ,
403
- queryValidator ,
404
- skip ,
405
- batchSize ,
406
- secondaryOk ,
407
- partialOk ,
408
- noCursorTimeout ,
409
- oplogReplay : false ,
410
- tailableCursor ,
411
- awaitData ,
412
- serializer ,
413
- messageEncoderSettings ,
414
- cancellationToken ) ;
415
- #pragma warning restore 618
416
- }
417
-
418
- [ Obsolete ( "Use the newest overload instead." ) ]
419
- public CursorBatch < TDocument > Query < TDocument > (
420
- CollectionNamespace collectionNamespace ,
421
- BsonDocument query ,
422
- BsonDocument fields ,
423
- IElementNameValidator queryValidator ,
424
- int skip ,
425
- int batchSize ,
426
- bool secondaryOk ,
427
- bool partialOk ,
428
- bool noCursorTimeout ,
429
- bool oplogReplay ,
430
- bool tailableCursor ,
431
- bool awaitData ,
432
- IBsonSerializer < TDocument > serializer ,
433
- MessageEncoderSettings messageEncoderSettings ,
434
- CancellationToken cancellationToken )
435
- {
436
- secondaryOk = GetEffectiveSecondaryOk ( secondaryOk ) ;
437
- #pragma warning disable 618
438
- var protocol = new QueryWireProtocol < TDocument > (
439
- collectionNamespace ,
440
- query ,
441
- fields ,
442
- queryValidator ,
443
- skip ,
444
- batchSize ,
445
- secondaryOk ,
446
- partialOk ,
447
- noCursorTimeout ,
448
- oplogReplay ,
449
- tailableCursor ,
450
- awaitData ,
451
- serializer ,
452
- messageEncoderSettings ) ;
453
- #pragma warning restore 618
454
-
455
- return ExecuteProtocol ( protocol , cancellationToken ) ;
456
- }
457
-
458
- public Task < CursorBatch < TDocument > > QueryAsync < TDocument > (
459
- CollectionNamespace collectionNamespace ,
460
- BsonDocument query ,
461
- BsonDocument fields ,
462
- IElementNameValidator queryValidator ,
463
- int skip ,
464
- int batchSize ,
465
- bool secondaryOk ,
466
- bool partialOk ,
467
- bool noCursorTimeout ,
468
- bool tailableCursor ,
469
- bool awaitData ,
470
- IBsonSerializer < TDocument > serializer ,
471
- MessageEncoderSettings messageEncoderSettings ,
472
- CancellationToken cancellationToken )
473
- {
474
- #pragma warning disable 618
475
- return QueryAsync (
476
- collectionNamespace ,
477
- query ,
478
- fields ,
479
- queryValidator ,
480
- skip ,
481
- batchSize ,
482
- secondaryOk ,
483
- partialOk ,
484
- noCursorTimeout ,
485
- oplogReplay : false ,
486
- tailableCursor ,
487
- awaitData ,
488
- serializer ,
489
- messageEncoderSettings ,
490
- cancellationToken ) ;
491
- #pragma warning restore 618
492
- }
493
-
494
- [ Obsolete ( "Use the newest overload instead." ) ]
495
- public Task < CursorBatch < TDocument > > QueryAsync < TDocument > (
496
- CollectionNamespace collectionNamespace ,
497
- BsonDocument query ,
498
- BsonDocument fields ,
499
- IElementNameValidator queryValidator ,
500
- int skip ,
501
- int batchSize ,
502
- bool secondaryOk ,
503
- bool partialOk ,
504
- bool noCursorTimeout ,
505
- bool oplogReplay ,
506
- bool tailableCursor ,
507
- bool awaitData ,
508
- IBsonSerializer < TDocument > serializer ,
509
- MessageEncoderSettings messageEncoderSettings ,
510
- CancellationToken cancellationToken )
511
- {
512
- secondaryOk = GetEffectiveSecondaryOk ( secondaryOk ) ;
513
- #pragma warning disable 618
514
- var protocol = new QueryWireProtocol < TDocument > (
515
- collectionNamespace ,
516
- query ,
517
- fields ,
518
- queryValidator ,
519
- skip ,
520
- batchSize ,
521
- secondaryOk ,
522
- partialOk ,
523
- noCursorTimeout ,
524
- oplogReplay ,
525
- tailableCursor ,
526
- awaitData ,
527
- serializer ,
528
- messageEncoderSettings ) ;
529
- #pragma warning restore 618
530
-
531
- return ExecuteProtocolAsync ( protocol , cancellationToken ) ;
532
- }
533
-
534
382
private ICoreSession CreateClusterClockAdvancingCoreSession ( ICoreSession session )
535
383
{
536
384
return new ClusterClockAdvancingCoreSession ( session , _server . ClusterClock ) ;
537
385
}
538
386
539
- private TResult ExecuteProtocol < TResult > ( IWireProtocol < TResult > protocol , CancellationToken cancellationToken )
540
- {
541
- try
542
- {
543
- return protocol . Execute ( _connection , cancellationToken ) ;
544
- }
545
- catch ( Exception ex )
546
- {
547
- _server . HandleChannelException ( _connection , ex ) ;
548
- throw ;
549
- }
550
- }
551
-
552
387
private TResult ExecuteProtocol < TResult > ( IWireProtocol < TResult > protocol , ICoreSession session , CancellationToken cancellationToken )
553
388
{
554
389
try
@@ -563,19 +398,6 @@ private TResult ExecuteProtocol<TResult>(IWireProtocol<TResult> protocol, ICoreS
563
398
}
564
399
}
565
400
566
- private async Task < TResult > ExecuteProtocolAsync < TResult > ( IWireProtocol < TResult > protocol , CancellationToken cancellationToken )
567
- {
568
- try
569
- {
570
- return await protocol . ExecuteAsync ( _connection , cancellationToken ) . ConfigureAwait ( false ) ;
571
- }
572
- catch ( Exception ex )
573
- {
574
- _server . HandleChannelException ( _connection , ex ) ;
575
- throw ;
576
- }
577
- }
578
-
579
401
private async Task < TResult > ExecuteProtocolAsync < TResult > ( IWireProtocol < TResult > protocol , ICoreSession session , CancellationToken cancellationToken )
580
402
{
581
403
try
@@ -597,16 +419,6 @@ public IChannelHandle Fork()
597
419
return new ServerChannel ( _server , _connection . Fork ( ) , false ) ;
598
420
}
599
421
600
- private bool GetEffectiveSecondaryOk ( bool secondaryOk )
601
- {
602
- if ( _server . DirectConnection && _server . Description . Type != ServerType . ShardRouter )
603
- {
604
- return true ;
605
- }
606
-
607
- return secondaryOk ;
608
- }
609
-
610
422
private void MarkSessionDirtyIfNeeded ( ICoreSession session , Exception ex )
611
423
{
612
424
if ( ex is MongoConnectionException )
0 commit comments