Skip to content

Commit 3810adb

Browse files
authored
Merge branch '4.4' into merge-4.3-into-4.4-1717138896794
2 parents 3c8a3fb + efe1a89 commit 3810adb

18 files changed

+991
-108
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [4.4.0] - 2024-05-31
5+
6+
* Support collection name prefix by @GromNaN in [#2930](https://github.com/mongodb/laravel-mongodb/pull/2930)
7+
* Ignore `_id: null` to let MongoDB generate an `ObjectId` by @GromNaN in [#2969](https://github.com/mongodb/laravel-mongodb/pull/2969)
8+
* Add `mongodb` driver for Batching by @GromNaN in [#2904](https://github.com/mongodb/laravel-mongodb/pull/2904)
9+
* Rename queue option `table` to `collection`
10+
* Replace queue option `expire` with `retry_after`
11+
* Revert behavior of `createOrFirst` to delegate to `firstOrCreate` when in transaction by @GromNaN in [#2984](https://github.com/mongodb/laravel-mongodb/pull/2984)
12+
413
## [4.3.1] - 2024-05-31
514

615
* Fix memory leak when filling nested fields using dot notation by @GromNaN in [#2962](https://github.com/mongodb/laravel-mongodb/pull/2962)

composer.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
"spatie/laravel-query-builder": "^5.6",
4242
"phpstan/phpstan": "^1.10"
4343
},
44+
"conflict": {
45+
"illuminate/bus": "< 10.37.2"
46+
},
4447
"suggest": {
4548
"mongodb/builder": "Provides a fluent aggregation builder for MongoDB pipelines"
4649
},
@@ -62,7 +65,8 @@
6265
"laravel": {
6366
"providers": [
6467
"MongoDB\\Laravel\\MongoDBServiceProvider",
65-
"MongoDB\\Laravel\\MongoDBQueueServiceProvider"
68+
"MongoDB\\Laravel\\MongoDBQueueServiceProvider",
69+
"MongoDB\\Laravel\\MongoDBBusServiceProvider"
6670
]
6771
}
6872
},

docs/queues.txt

+88-8
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Queues
1111
.. meta::
1212
:keywords: php framework, odm, code example
1313

14-
If you want to use MongoDB as your database backend for Laravel Queue, change
14+
If you want to use MongoDB as your database backend for Laravel Queue, change
1515
the driver in ``config/queue.php``:
1616

1717
.. code-block:: php
@@ -20,27 +20,107 @@ the driver in ``config/queue.php``:
2020
'database' => [
2121
'driver' => 'mongodb',
2222
// You can also specify your jobs specific database created on config/database.php
23-
'connection' => 'mongodb-job',
24-
'table' => 'jobs',
23+
'connection' => 'mongodb',
24+
'collection' => 'jobs',
2525
'queue' => 'default',
26-
'expire' => 60,
26+
'retry_after' => 60,
2727
],
2828
],
2929

30-
If you want to use MongoDB to handle failed jobs, change the database in
30+
.. list-table::
31+
:header-rows: 1
32+
:widths: 25 75
33+
34+
* - Setting
35+
- Description
36+
37+
* - ``driver``
38+
- **Required**. Specifies the queue driver to use. Must be ``mongodb``.
39+
40+
* - ``connection``
41+
- The database connection used to store jobs. It must be a ``mongodb`` connection. The driver uses the default connection if a connection is not specified.
42+
43+
* - ``collection``
44+
- **Required**. Name of the MongoDB collection to store jobs to process.
45+
46+
* - ``queue``
47+
- **Required**. Name of the queue.
48+
49+
* - ``retry_after``
50+
- Specifies how many seconds the queue connection should wait before retrying a job that is being processed. Defaults to ``60``.
51+
52+
If you want to use MongoDB to handle failed jobs, change the database in
3153
``config/queue.php``:
3254

3355
.. code-block:: php
3456

3557
'failed' => [
3658
'driver' => 'mongodb',
37-
// You can also specify your jobs specific database created on config/database.php
38-
'database' => 'mongodb-job',
39-
'table' => 'failed_jobs',
59+
'database' => 'mongodb',
60+
'collection' => 'failed_jobs',
4061
],
4162

63+
.. list-table::
64+
:header-rows: 1
65+
:widths: 25 75
66+
67+
* - Setting
68+
- Description
69+
70+
* - ``driver``
71+
- **Required**. Specifies the queue driver to use. Must be ``mongodb``.
72+
73+
* - ``connection``
74+
- The database connection used to store jobs. It must be a ``mongodb`` connection. The driver uses the default connection if a connection is not specified.
75+
76+
* - ``collection``
77+
- Name of the MongoDB collection to store failed jobs. Defaults to ``failed_jobs``.
78+
79+
4280
Add the service provider in ``config/app.php``:
4381

4482
.. code-block:: php
4583

4684
MongoDB\Laravel\MongoDBQueueServiceProvider::class,
85+
86+
87+
Job Batching
88+
------------
89+
90+
`Job batching <https://laravel.com/docs/{+laravel-docs-version+}/queues#job-batching>`__
91+
is a Laravel feature to execute a batch of jobs and subsequent actions before,
92+
after, and during the execution of the jobs from the queue.
93+
94+
With MongoDB, you don't have to create any collection before using job batching.
95+
The ``job_batches`` collection is created automatically to store meta
96+
information about your job batches, such as their completion percentage.
97+
98+
.. code-block:: php
99+
100+
'batching' => [
101+
'driver' => 'mongodb',
102+
'database' => 'mongodb',
103+
'collection' => 'job_batches',
104+
],
105+
106+
.. list-table::
107+
:header-rows: 1
108+
:widths: 25 75
109+
110+
* - Setting
111+
- Description
112+
113+
* - ``driver``
114+
- **Required**. Specifies the queue driver to use. Must be ``mongodb``.
115+
116+
* - ``connection``
117+
- The database connection used to store jobs. It must be a ``mongodb`` connection. The driver uses the default connection if a connection is not specified.
118+
119+
* - ``collection``
120+
- Name of the MongoDB collection to store job batches. Defaults to ``job_batches``.
121+
122+
Add the service provider in ``config/app.php``:
123+
124+
.. code-block:: php
125+
126+
MongoDB\Laravel\MongoDBBusServiceProvider::class,

phpstan-baseline.neon

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
parameters:
22
ignoreErrors:
3+
-
4+
message: "#^Access to an undefined property Illuminate\\\\Container\\\\Container\\:\\:\\$config\\.$#"
5+
count: 3
6+
path: src/MongoDBBusServiceProvider.php
7+
38
-
49
message: "#^Method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:push\\(\\) invoked with 3 parameters, 0 required\\.$#"
510
count: 2

0 commit comments

Comments
 (0)