Skip to content

Commit

Permalink
Merge branch '4.4' into merge-4.3-into-4.4-1717138896794
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN authored May 31, 2024
2 parents 3c8a3fb + efe1a89 commit 3810adb
Show file tree
Hide file tree
Showing 18 changed files with 991 additions and 108 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Changelog
All notable changes to this project will be documented in this file.

## [4.4.0] - 2024-05-31

* Support collection name prefix by @GromNaN in [#2930](https://github.com/mongodb/laravel-mongodb/pull/2930)
* Ignore `_id: null` to let MongoDB generate an `ObjectId` by @GromNaN in [#2969](https://github.com/mongodb/laravel-mongodb/pull/2969)
* Add `mongodb` driver for Batching by @GromNaN in [#2904](https://github.com/mongodb/laravel-mongodb/pull/2904)
* Rename queue option `table` to `collection`
* Replace queue option `expire` with `retry_after`
* Revert behavior of `createOrFirst` to delegate to `firstOrCreate` when in transaction by @GromNaN in [#2984](https://github.com/mongodb/laravel-mongodb/pull/2984)

## [4.3.1] - 2024-05-31

* Fix memory leak when filling nested fields using dot notation by @GromNaN in [#2962](https://github.com/mongodb/laravel-mongodb/pull/2962)
Expand Down
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
"spatie/laravel-query-builder": "^5.6",
"phpstan/phpstan": "^1.10"
},
"conflict": {
"illuminate/bus": "< 10.37.2"
},
"suggest": {
"mongodb/builder": "Provides a fluent aggregation builder for MongoDB pipelines"
},
Expand All @@ -62,7 +65,8 @@
"laravel": {
"providers": [
"MongoDB\\Laravel\\MongoDBServiceProvider",
"MongoDB\\Laravel\\MongoDBQueueServiceProvider"
"MongoDB\\Laravel\\MongoDBQueueServiceProvider",
"MongoDB\\Laravel\\MongoDBBusServiceProvider"
]
}
},
Expand Down
96 changes: 88 additions & 8 deletions docs/queues.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Queues
.. meta::
:keywords: php framework, odm, code example

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

.. code-block:: php
Expand All @@ -20,27 +20,107 @@ the driver in ``config/queue.php``:
'database' => [
'driver' => 'mongodb',
// You can also specify your jobs specific database created on config/database.php
'connection' => 'mongodb-job',
'table' => 'jobs',
'connection' => 'mongodb',
'collection' => 'jobs',
'queue' => 'default',
'expire' => 60,
'retry_after' => 60,
],
],

If you want to use MongoDB to handle failed jobs, change the database in
.. list-table::
:header-rows: 1
:widths: 25 75

* - Setting
- Description

* - ``driver``
- **Required**. Specifies the queue driver to use. Must be ``mongodb``.

* - ``connection``
- 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.

* - ``collection``
- **Required**. Name of the MongoDB collection to store jobs to process.

* - ``queue``
- **Required**. Name of the queue.

* - ``retry_after``
- Specifies how many seconds the queue connection should wait before retrying a job that is being processed. Defaults to ``60``.

If you want to use MongoDB to handle failed jobs, change the database in
``config/queue.php``:

.. code-block:: php

'failed' => [
'driver' => 'mongodb',
// You can also specify your jobs specific database created on config/database.php
'database' => 'mongodb-job',
'table' => 'failed_jobs',
'database' => 'mongodb',
'collection' => 'failed_jobs',
],

.. list-table::
:header-rows: 1
:widths: 25 75

* - Setting
- Description

* - ``driver``
- **Required**. Specifies the queue driver to use. Must be ``mongodb``.

* - ``connection``
- 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.

* - ``collection``
- Name of the MongoDB collection to store failed jobs. Defaults to ``failed_jobs``.


Add the service provider in ``config/app.php``:

.. code-block:: php

MongoDB\Laravel\MongoDBQueueServiceProvider::class,


Job Batching
------------

`Job batching <https://laravel.com/docs/{+laravel-docs-version+}/queues#job-batching>`__
is a Laravel feature to execute a batch of jobs and subsequent actions before,
after, and during the execution of the jobs from the queue.

With MongoDB, you don't have to create any collection before using job batching.
The ``job_batches`` collection is created automatically to store meta
information about your job batches, such as their completion percentage.

.. code-block:: php

'batching' => [
'driver' => 'mongodb',
'database' => 'mongodb',
'collection' => 'job_batches',
],

.. list-table::
:header-rows: 1
:widths: 25 75

* - Setting
- Description

* - ``driver``
- **Required**. Specifies the queue driver to use. Must be ``mongodb``.

* - ``connection``
- 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.

* - ``collection``
- Name of the MongoDB collection to store job batches. Defaults to ``job_batches``.

Add the service provider in ``config/app.php``:

.. code-block:: php

MongoDB\Laravel\MongoDBBusServiceProvider::class,
5 changes: 5 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
parameters:
ignoreErrors:
-
message: "#^Access to an undefined property Illuminate\\\\Container\\\\Container\\:\\:\\$config\\.$#"
count: 3
path: src/MongoDBBusServiceProvider.php

-
message: "#^Method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:push\\(\\) invoked with 3 parameters, 0 required\\.$#"
count: 2
Expand Down
Loading

0 comments on commit 3810adb

Please sign in to comment.