Skip to content

Commit 6fd00ef

Browse files
committed
Merged pull request #854
2 parents a207c77 + 94e8ab0 commit 6fd00ef

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

config.m4

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,13 @@ if test "$PHP_MONGODB" != "no"; then
188188
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
189189
AC_MSG_CHECKING(for libbson)
190190
if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libbson-1.0; then
191-
if $PKG_CONFIG libbson-1.0 --atleast-version 1.10.0; then
191+
if $PKG_CONFIG libbson-1.0 --atleast-version 1.11.0; then
192192
PHP_MONGODB_BSON_CFLAGS=`$PKG_CONFIG libbson-1.0 --cflags`
193193
PHP_MONGODB_BSON_LIBS=`$PKG_CONFIG libbson-1.0 --libs`
194194
PHP_MONGODB_BSON_VERSION=`$PKG_CONFIG libbson-1.0 --modversion`
195195
AC_MSG_RESULT(version $PHP_MONGODB_BSON_VERSION found)
196196
else
197-
AC_MSG_ERROR(system libbson must be upgraded to version >= 1.10.0)
197+
AC_MSG_ERROR(system libbson must be upgraded to version >= 1.11.0)
198198
fi
199199
else
200200
AC_MSG_ERROR(pkgconfig and libbson must be installed)
@@ -212,13 +212,13 @@ if test "$PHP_MONGODB" != "no"; then
212212
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
213213
AC_MSG_CHECKING(for libmongoc)
214214
if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libmongoc-1.0; then
215-
if $PKG_CONFIG libmongoc-1.0 --atleast-version 1.10.0; then
215+
if $PKG_CONFIG libmongoc-1.0 --atleast-version 1.11.0; then
216216
PHP_MONGODB_MONGOC_CFLAGS=`$PKG_CONFIG libmongoc-1.0 --cflags`
217217
PHP_MONGODB_MONGOC_LIBS=`$PKG_CONFIG libmongoc-1.0 --libs`
218218
PHP_MONGODB_MONGOC_VERSION=`$PKG_CONFIG libmongoc-1.0 --modversion`
219219
AC_MSG_RESULT(version $PHP_MONGODB_MONGOC_VERSION found)
220220
else
221-
AC_MSG_ERROR(system libmongoc must be upgraded to version >= 1.10.0)
221+
AC_MSG_ERROR(system libmongoc must be upgraded to version >= 1.11.0)
222222
fi
223223
else
224224
AC_MSG_ERROR(pkgconfig and libmongoc must be installed)

php_phongo.c

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -963,36 +963,44 @@ bool phongo_execute_command(mongoc_client_t* client, php_phongo_command_type_t t
963963
goto cleanup;
964964
}
965965

966-
/* According to mongoc_cursor_new_from_command_reply(), the reply bson_t
967-
* is ultimately destroyed on both success and failure. */
966+
/* According to mongoc_cursor_new_from_command_reply_with_opts(), the reply
967+
* bson_t is ultimately destroyed on both success and failure. */
968968
if (bson_iter_init_find(&iter, &reply, "cursor") && BSON_ITER_HOLDS_DOCUMENT(&iter)) {
969969
bson_t initial_reply = BSON_INITIALIZER;
970+
bson_t cursor_opts = BSON_INITIALIZER;
970971
bson_error_t error = { 0 };
971972

972973
bson_copy_to(&reply, &initial_reply);
973974

975+
bson_append_int32(&cursor_opts, "serverId", -1, server_id);
976+
974977
if (command->max_await_time_ms) {
975-
bson_append_bool(&initial_reply, "awaitData", -1, 1);
976-
bson_append_int64(&initial_reply, "maxAwaitTimeMS", -1, command->max_await_time_ms);
977-
bson_append_bool(&initial_reply, "tailable", -1, 1);
978+
bson_append_bool(&cursor_opts, "awaitData", -1, 1);
979+
bson_append_int64(&cursor_opts, "maxAwaitTimeMS", -1, command->max_await_time_ms);
980+
bson_append_bool(&cursor_opts, "tailable", -1, 1);
978981
}
979982

980983
if (command->batch_size) {
981-
bson_append_int64(&initial_reply, "batchSize", -1, command->batch_size);
984+
bson_append_int64(&cursor_opts, "batchSize", -1, command->batch_size);
982985
}
983986

984-
if (zsession && !mongoc_client_session_append(Z_SESSION_OBJ_P(zsession)->client_session, &initial_reply, &error)) {
987+
if (zsession && !mongoc_client_session_append(Z_SESSION_OBJ_P(zsession)->client_session, &cursor_opts, &error)) {
985988
phongo_throw_exception_from_bson_error_t(&error TSRMLS_CC);
986989
bson_destroy(&initial_reply);
990+
bson_destroy(&cursor_opts);
987991
result = false;
988992
goto cleanup;
989993
}
990994

991-
cmd_cursor = mongoc_cursor_new_from_command_reply(client, &initial_reply, server_id);
995+
cmd_cursor = mongoc_cursor_new_from_command_reply_with_opts(client, &initial_reply, &cursor_opts);
996+
bson_destroy(&cursor_opts);
992997
} else {
998+
bson_t cursor_opts = BSON_INITIALIZER;
993999
bson_t* wrapped_reply = create_wrapped_command_envelope(db, &reply);
9941000

995-
cmd_cursor = mongoc_cursor_new_from_command_reply(client, wrapped_reply, server_id);
1001+
bson_append_int32(&cursor_opts, "serverId", -1, server_id);
1002+
cmd_cursor = mongoc_cursor_new_from_command_reply_with_opts(client, wrapped_reply, &cursor_opts);
1003+
bson_destroy(&cursor_opts);
9961004
}
9971005

9981006
phongo_cursor_init_for_command(return_value, client, cmd_cursor, db, zcommand, zreadPreference, zsession TSRMLS_CC);

src/MongoDB/ReadConcern.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ void php_phongo_readconcern_init_ce(INIT_FUNC_ARGS) /* {{{ */
243243
zend_declare_class_constant_stringl(php_phongo_readconcern_ce, ZEND_STRL("LOCAL"), ZEND_STRL(MONGOC_READ_CONCERN_LEVEL_LOCAL) TSRMLS_CC);
244244
zend_declare_class_constant_stringl(php_phongo_readconcern_ce, ZEND_STRL("MAJORITY"), ZEND_STRL(MONGOC_READ_CONCERN_LEVEL_MAJORITY) TSRMLS_CC);
245245
zend_declare_class_constant_stringl(php_phongo_readconcern_ce, ZEND_STRL("LINEARIZABLE"), ZEND_STRL(MONGOC_READ_CONCERN_LEVEL_LINEARIZABLE) TSRMLS_CC);
246-
zend_declare_class_constant_stringl(php_phongo_readconcern_ce, ZEND_STRL("AVAILABLE"), ZEND_STRL("available") TSRMLS_CC);
246+
zend_declare_class_constant_stringl(php_phongo_readconcern_ce, ZEND_STRL("AVAILABLE"), ZEND_STRL(MONGOC_READ_CONCERN_LEVEL_AVAILABLE) TSRMLS_CC);
247247
} /* }}} */
248248

249249
/*

src/libmongoc

Submodule libmongoc updated 166 files

0 commit comments

Comments
 (0)