@@ -455,6 +455,19 @@ _mongoc_write_command_delete (mongoc_write_command_t *command,
455
455
BSON_ASSERT (hint );
456
456
BSON_ASSERT (collection );
457
457
458
+ /*
459
+ * If we have an unacknowledged write and the server supports the legacy
460
+ * opcodes, then submit the legacy opcode so we don't need to wait for
461
+ * a response from the server.
462
+ */
463
+ if ((client -> cluster .nodes [hint - 1 ].min_wire_version == 0 ) &&
464
+ !_mongoc_write_concern_has_gle (write_concern )) {
465
+ _mongoc_write_command_delete_legacy (command , client , hint , database ,
466
+ collection , write_concern , result ,
467
+ error );
468
+ EXIT ;
469
+ }
470
+
458
471
BSON_APPEND_UTF8 (& cmd , "delete" , collection );
459
472
BSON_APPEND_DOCUMENT (& cmd , "writeConcern" ,
460
473
WRITE_CONCERN_DOC (write_concern ));
@@ -515,6 +528,19 @@ _mongoc_write_command_insert (mongoc_write_command_t *command,
515
528
BSON_ASSERT (hint );
516
529
BSON_ASSERT (collection );
517
530
531
+ /*
532
+ * If we have an unacknowledged write and the server supports the legacy
533
+ * opcodes, then submit the legacy opcode so we don't need to wait for
534
+ * a response from the server.
535
+ */
536
+ if ((client -> cluster .nodes [hint - 1 ].min_wire_version == 0 ) &&
537
+ !_mongoc_write_concern_has_gle (write_concern )) {
538
+ _mongoc_write_command_insert_legacy (command , client , hint , database ,
539
+ collection , write_concern , result ,
540
+ error );
541
+ EXIT ;
542
+ }
543
+
518
544
if (!command -> u .insert .n_documents ||
519
545
!bson_iter_init (& iter , command -> u .insert .documents ) ||
520
546
!bson_iter_next (& iter )) {
@@ -618,6 +644,19 @@ _mongoc_write_command_update (mongoc_write_command_t *command,
618
644
BSON_ASSERT (hint );
619
645
BSON_ASSERT (collection );
620
646
647
+ /*
648
+ * If we have an unacknowledged write and the server supports the legacy
649
+ * opcodes, then submit the legacy opcode so we don't need to wait for
650
+ * a response from the server.
651
+ */
652
+ if ((client -> cluster .nodes [hint - 1 ].min_wire_version == 0 ) &&
653
+ !_mongoc_write_concern_has_gle (write_concern )) {
654
+ _mongoc_write_command_update_legacy (command , client , hint , database ,
655
+ collection , write_concern , result ,
656
+ error );
657
+ EXIT ;
658
+ }
659
+
621
660
BSON_APPEND_UTF8 (& cmd , "update" , collection );
622
661
BSON_APPEND_DOCUMENT (& cmd , "writeConcern" ,
623
662
WRITE_CONCERN_DOC (write_concern ));
0 commit comments