Skip to content

Commit 393cfb8

Browse files
Merge v1.x into v2.x (#1796)
2 parents 6fc2c54 + 564c377 commit 393cfb8

File tree

9 files changed

+120
-16
lines changed

9 files changed

+120
-16
lines changed

.evergreen/config/generated/build/build-libmongoc.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.evergreen/config/templates/build/build-libmongoc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- func: "compile driver"
1111
vars:
1212
PHP_VERSION: "%phpVersion%"
13-
LIBMONGOC_VERSION: "1.30.0"
13+
LIBMONGOC_VERSION: "1.30.1"
1414
- func: "upload build"
1515

1616
- name: "build-php-%phpVersion%-libmongoc-next-stable"

config.m4

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,26 +237,26 @@ if test "$PHP_MONGODB" != "no"; then
237237
PHP_MONGODB_MONGOCRYPT_VERSION_STRING="None"
238238

239239
if test "$PHP_MONGODB_SYSTEM_LIBS" != "no"; then
240-
PKG_CHECK_MODULES([PHP_MONGODB_BSON], [libbson-1.0 >= 1.30.0], [
240+
PKG_CHECK_MODULES([PHP_MONGODB_BSON], [libbson-1.0 >= 1.30.1], [
241241
PHP_MONGODB_BSON_VERSION=`$PKG_CONFIG libbson-1.0 --modversion`
242242
PHP_MONGODB_BSON_VERSION_STRING="System ($PHP_MONGODB_BSON_VERSION)"
243243
244244
PHP_MONGODB_CFLAGS="$PHP_MONGODB_CFLAGS $PHP_MONGODB_BSON_CFLAGS"
245245
PHP_EVAL_LIBLINE($PHP_MONGODB_BSON_LIBS, MONGODB_SHARED_LIBADD)
246246
AC_DEFINE(HAVE_SYSTEM_LIBBSON, 1, [Use system libbson])
247247
],[
248-
AC_MSG_ERROR([Could not find system library for libbson >= 1.30.0])
248+
AC_MSG_ERROR([Could not find system library for libbson >= 1.30.1])
249249
])
250250

251-
PKG_CHECK_MODULES([PHP_MONGODB_MONGOC], [libmongoc-1.0 >= 1.30.0], [
251+
PKG_CHECK_MODULES([PHP_MONGODB_MONGOC], [libmongoc-1.0 >= 1.30.1], [
252252
PHP_MONGODB_BSON_VERSION=`$PKG_CONFIG libbson-1.0 --modversion`
253253
PHP_MONGODB_BSON_VERSION_STRING="System ($PHP_MONGODB_BSON_VERSION)"
254254
255255
PHP_MONGODB_CFLAGS="$PHP_MONGODB_CFLAGS $PHP_MONGODB_MONGOC_CFLAGS"
256256
PHP_EVAL_LIBLINE($PHP_MONGODB_MONGOC_LIBS, MONGODB_SHARED_LIBADD)
257257
AC_DEFINE(HAVE_SYSTEM_LIBMONGOC, 1, [Use system libmongoc])
258258
],[
259-
AC_MSG_ERROR(Could not find system library for libmongoc >= 1.30.0)
259+
AC_MSG_ERROR(Could not find system library for libmongoc >= 1.30.1)
260260
])
261261

262262
if test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" != "no"; then

sbom.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,34 @@
1919
"version": "1.12.0"
2020
},
2121
{
22-
"bom-ref": "pkg:github/mongodb/[email protected].0",
22+
"bom-ref": "pkg:github/mongodb/[email protected].1",
2323
"externalReferences": [
2424
{
2525
"type": "distribution",
26-
"url": "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/1.30.0.tar.gz"
26+
"url": "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/1.30.1.tar.gz"
2727
},
2828
{
2929
"type": "website",
30-
"url": "https://github.com/mongodb/mongo-c-driver/tree/1.30.0"
30+
"url": "https://github.com/mongodb/mongo-c-driver/tree/1.30.1"
3131
}
3232
],
3333
"group": "mongodb",
3434
"name": "mongo-c-driver",
35-
"purl": "pkg:github/mongodb/[email protected].0",
35+
"purl": "pkg:github/mongodb/[email protected].1",
3636
"type": "library",
37-
"version": "1.30.0"
37+
"version": "1.30.1"
3838
}
3939
],
4040
"dependencies": [
4141
{
4242
"ref": "pkg:github/mongodb/[email protected]"
4343
},
4444
{
45-
"ref": "pkg:github/mongodb/[email protected].0"
45+
"ref": "pkg:github/mongodb/[email protected].1"
4646
}
4747
],
4848
"metadata": {
49-
"timestamp": "2025-02-07T15:48:29.888317+00:00",
49+
"timestamp": "2025-02-21T15:21:36.741928+00:00",
5050
"tools": [
5151
{
5252
"externalReferences": [
@@ -90,7 +90,7 @@
9090
]
9191
},
9292
"serialNumber": "urn:uuid:acb30d08-ee47-4ff0-b301-d66ef1f54082",
93-
"version": 9,
93+
"version": 10,
9494
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
9595
"bomFormat": "CycloneDX",
9696
"specVersion": "1.5",

src/LIBMONGOC_VERSION_CURRENT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.30.0
1+
1.30.1

src/MongoDB/BulkWrite.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ static bool php_phongo_bulkwrite_update_apply_options(bson_t* boptions, zval* zo
280280
PHONGO_BULKWRITE_APPEND_BOOL("upsert", upsert);
281281
PHONGO_BULKWRITE_OPT_ARRAY("arrayFilters");
282282
PHONGO_BULKWRITE_OPT_DOCUMENT("collation");
283+
PHONGO_BULKWRITE_OPT_DOCUMENT("sort");
283284

284285
if (!php_phongo_bulkwrite_opt_hint(boptions, zoptions)) {
285286
return false;

tests/bulk/bulkwrite-update-008.phpt

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
--TEST--
2+
MongoDB\Driver\BulkWrite::update() with sort option
3+
--SKIPIF--
4+
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
5+
<?php skip_if_not_live(); ?>
6+
<?php skip_if_server_version('<', '8.0'); ?>
7+
<?php skip_if_not_clean(); ?>
8+
--FILE--
9+
<?php
10+
require_once __DIR__ . "/../utils/basic.inc";
11+
12+
class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber
13+
{
14+
public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void
15+
{
16+
if ($event->getCommandName() !== 'update') {
17+
return;
18+
}
19+
20+
printf("update included sort: %s\n", json_encode($event->getCommand()->updates[0]->sort));
21+
}
22+
23+
public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void
24+
{
25+
}
26+
27+
public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void
28+
{
29+
}
30+
}
31+
32+
$manager = create_test_manager();
33+
34+
$bulk = new MongoDB\Driver\BulkWrite();
35+
$bulk->insert(['_id' => 1]);
36+
$bulk->insert(['_id' => 2]);
37+
$bulk->insert(['_id' => 3]);
38+
$manager->executeBulkWrite(NS, $bulk);
39+
40+
MongoDB\Driver\Monitoring\addSubscriber(new CommandLogger);
41+
42+
$bulk = new MongoDB\Driver\BulkWrite;
43+
$bulk->update(['_id' => ['$gt' => 1]], ['$set' => ['x' => 11]], ['sort' => ['_id' => 1]]);
44+
$manager->executeBulkWrite(NS, $bulk);
45+
46+
$bulk = new MongoDB\Driver\BulkWrite;
47+
$bulk->update(['_id' => ['$gt' => 1]], ['x' => 22], ['sort' => ['_id' => -1]]);
48+
$manager->executeBulkWrite(NS, $bulk);
49+
50+
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query([]));
51+
52+
var_dump($cursor->toArray());
53+
54+
?>
55+
===DONE===
56+
<?php exit(0); ?>
57+
--EXPECTF--
58+
update included sort: {"_id":1}
59+
update included sort: {"_id":-1}
60+
array(3) {
61+
[0]=>
62+
object(stdClass)#%d (%d) {
63+
["_id"]=>
64+
int(1)
65+
}
66+
[1]=>
67+
object(stdClass)#%d (%d) {
68+
["_id"]=>
69+
int(2)
70+
["x"]=>
71+
int(11)
72+
}
73+
[2]=>
74+
object(stdClass)#%d (%d) {
75+
["_id"]=>
76+
int(3)
77+
["x"]=>
78+
int(22)
79+
}
80+
}
81+
===DONE===
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
MongoDB\Driver\BulkWrite::update() with multi:true prohibits sort option
3+
--SKIPIF--
4+
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
5+
--FILE--
6+
<?php
7+
require_once __DIR__ . "/../utils/basic.inc";
8+
9+
$manager = create_test_manager();
10+
$bulk = new MongoDB\Driver\BulkWrite;
11+
12+
echo throws(function() use ($manager, $bulk) {
13+
$bulk->update(['x' => ['$gt' => 1]], ['$set' => ['y' => 11]], ['multi' => true, 'sort' => ['x' => 1]]);
14+
}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
15+
16+
?>
17+
===DONE===
18+
<?php exit(0); ?>
19+
--EXPECT--
20+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
21+
Invalid option 'sort'
22+
===DONE===

0 commit comments

Comments
 (0)