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

HHVM-223: Query and command execution should use mongoc_cursor_set_hint() #99

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ HPHP::Object Utils::doExecuteCommand(const char *db, mongoc_client_t *client, in
cursor = mongoc_client_command(client, db, MONGOC_QUERY_NONE, 0, 1, 0, command, NULL, read_preference);

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

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

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

/* This throws an exception upon error */
Expand Down