Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit 807a4a0

Browse files
committed
HHVM-223: Query and command execution should use mongoc_cursor_set_hint()
1 parent a779d0d commit 807a4a0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

utils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ HPHP::Object Utils::doExecuteCommand(const char *db, mongoc_client_t *client, in
263263
cursor = mongoc_client_command(client, db, MONGOC_QUERY_NONE, 0, 1, 0, command, NULL, read_preference);
264264

265265
/* Handle server hint */
266-
if (server_id > 0) {
267-
cursor->server_id = server_id;
266+
if (server_id > 0 && !mongoc_cursor_set_hint(cursor, server_id)) {
267+
throw throwRunTimeException("Could not set cursor server_id");
268268
}
269269

270270
/* This throws an exception upon error */
@@ -365,8 +365,8 @@ HPHP::Object Utils::doExecuteQuery(const HPHP::String ns, mongoc_client_t *clien
365365
mongoc_collection_destroy(collection);
366366

367367
/* Handle server hint */
368-
if (server_id > 0) {
369-
cursor->server_id = server_id;
368+
if (server_id > 0 && !mongoc_cursor_set_hint(cursor, server_id)) {
369+
throw throwRunTimeException("Could not set cursor server_id");
370370
}
371371

372372
/* This throws an exception upon error */

0 commit comments

Comments
 (0)