@@ -11,6 +11,16 @@ Queues
1111.. meta::
1212 :keywords: php framework, odm, code example, jobs
1313
14+ Overview
15+ --------
16+ 17+ In this guide, you can learn how to use MongoDB as your database for
18+ Laravel Queue. Laravel Queue allows you to create queued jobs that are
19+ processed in the background.
20+ 21+ Configuration
22+ -------------
23+ 1424To use MongoDB as your database for Laravel Queue, change
1525the driver in your application's ``config/queue.php`` file:
1626
@@ -22,7 +32,7 @@ the driver in your application's ``config/queue.php`` file:
2232 // You can also specify your jobs-specific database
2333 // in the config/database.php file
2434 'connection' => 'mongodb',
25- 'collection ' => 'jobs',
35+ 'table ' => 'jobs',
2636 'queue' => 'default',
2737 // Optional setting
2838 // 'retry_after' => 60,
@@ -48,7 +58,7 @@ the behavior of the queue:
4858 ``mongodb`` connection. The driver uses the default connection if
4959 a connection is not specified.
5060
51- * - ``collection ``
61+ * - ``table ``
5262 - **Required** Name of the MongoDB collection to
5363 store jobs to process.
5464
@@ -60,7 +70,7 @@ the behavior of the queue:
6070 before retrying a job that is being processed. The value is
6171 ``60`` by default.
6272
63- To use MongoDB to handle failed jobs, create a ``failed`` entry in your
73+ To use MongoDB to handle * failed jobs* , create a ``failed`` entry in your
6474application's ``config/queue.php`` file and specify the database and
6575collection:
6676
@@ -69,7 +79,7 @@ collection:
6979 'failed' => [
7080 'driver' => 'mongodb',
7181 'database' => 'mongodb',
72- 'collection ' => 'failed_jobs',
82+ 'table ' => 'failed_jobs',
7383 ],
7484
7585The following table describes properties that you can specify to configure
@@ -86,21 +96,20 @@ how to handle failed jobs:
8696 - **Required** Queue driver to use. The value of
8797 this property must be ``mongodb``.
8898
89- * - ``connection ``
99+ * - ``database ``
90100 - Database connection used to store jobs. It must be
91101 a ``mongodb`` connection. The driver uses the default connection
92102 if a connection is not specified.
93103
94- * - ``collection ``
104+ * - ``table ``
95105 - Name of the MongoDB collection to store failed
96106 jobs. The value is ``failed_jobs`` by default.
97107
98- Then, add the service provider in your application's
99- ``config/app.php`` file:
100- 101- .. code-block:: php
102- 103- MongoDB\Laravel\MongoDBQueueServiceProvider::class,
108+ To register failed jobs, you can use the default failed
109+ job provider from Laravel. To learn more, see
110+ `Dealing With Failed Jobs
111+ <https://laravel.com/docs/{+laravel-docs-version+}/queues#dealing-with-failed-jobs>`__ in
112+ the Laravel documentation on Queues.
104113
105114Job Batching
106115------------
@@ -124,7 +133,7 @@ application's ``config/queue.php`` file:
124133 'batching' => [
125134 'driver' => 'mongodb',
126135 'database' => 'mongodb',
127- 'collection ' => 'job_batches',
136+ 'table ' => 'job_batches',
128137 ],
129138
130139The following table describes properties that you can specify to configure
@@ -141,18 +150,18 @@ job batching:
141150 - **Required** Queue driver to use. The value of
142151 this property must be ``mongodb``.
143152
144- * - ``connection ``
153+ * - ``database ``
145154 - Database connection used to store jobs. It must be a
146155 ``mongodb`` connection. The driver uses the default connection if
147156 a connection is not specified.
148157
149- * - ``collection ``
158+ * - ``table ``
150159 - Name of the MongoDB collection to store job
151160 batches. The value is ``job_batches`` by default.
152161
153162Then, add the service provider in your application's ``config/app.php``
154163file:
155164
156- .. code-block:: php
157- 158- MongoDB\Laravel\MongoDBBusServiceProvider::class,
165+ The {+odm-short+} automatically provides the
166+ ``MongoDB\Laravel\MongoDBBusServiceProvider::class`` class as the
167+ service provider for job batching.
0 commit comments