Skip to content

Commit ff3061d

Browse files
bjorijmikola
authored andcommitted
Don't provide server_id when we have none
1 parent 490403a commit ff3061d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

php_phongo.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,9 @@ int phongo_execute_query(mongoc_client_t *client, const char *namespace, const p
726726
return false;
727727
}
728728

729-
cursor->hint = server_id;
729+
if (server_id > 0) {
730+
cursor->hint = server_id;
731+
}
730732
if (!mongoc_cursor_next(cursor, &doc)) {
731733
bson_error_t error;
732734

@@ -757,7 +759,9 @@ int phongo_execute_command(mongoc_client_t *client, const char *db, const bson_t
757759

758760

759761
cursor = mongoc_client_command(client, db, MONGOC_QUERY_NONE, 0, 1, 0, command, NULL, read_preference);
760-
cursor->hint = server_id;
762+
if (server_id > 0) {
763+
cursor->hint = server_id;
764+
}
761765

762766
if (!mongoc_cursor_next(cursor, &doc)) {
763767
bson_error_t error;

0 commit comments

Comments
 (0)