@@ -507,6 +507,18 @@ static PHP_METHOD(MongoDB_Driver_BulkWriteCommand, replaceOne)
507
507
bson_value_destroy (& bhint );
508
508
}
509
509
510
+ if (php_array_existsc (zoptions , "sort" )) {
511
+ bson_t bsort = BSON_INITIALIZER ;
512
+
513
+ if (!phongo_bwc_parse_document (php_array_fetchc_deref (zoptions , "sort" ), & bsort , "sort" )) {
514
+ bson_destroy (& bsort );
515
+ goto cleanup ;
516
+ }
517
+
518
+ mongoc_bulkwrite_replaceoneopts_set_sort (opts , & bsort );
519
+ bson_destroy (& bsort );
520
+ }
521
+
510
522
if (php_array_existsc (zoptions , "upsert" )) {
511
523
mongoc_bulkwrite_replaceoneopts_set_upsert (opts , php_array_fetchc_bool (zoptions , "upsert" ));
512
524
}
@@ -703,6 +715,18 @@ static PHP_METHOD(MongoDB_Driver_BulkWriteCommand, updateOne)
703
715
bson_value_destroy (& bhint );
704
716
}
705
717
718
+ if (php_array_existsc (zoptions , "sort" )) {
719
+ bson_t bsort = BSON_INITIALIZER ;
720
+
721
+ if (!phongo_bwc_parse_document (php_array_fetchc_deref (zoptions , "sort" ), & bsort , "sort" )) {
722
+ bson_destroy (& bsort );
723
+ goto cleanup ;
724
+ }
725
+
726
+ mongoc_bulkwrite_updateoneopts_set_sort (opts , & bsort );
727
+ bson_destroy (& bsort );
728
+ }
729
+
706
730
if (php_array_existsc (zoptions , "upsert" )) {
707
731
mongoc_bulkwrite_updateoneopts_set_upsert (opts , php_array_fetchc_bool (zoptions , "upsert" ));
708
732
}
0 commit comments