File tree 1 file changed +13
-0
lines changed
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,19 @@ The following example shows the syntax of a query builder call:
46
46
DB::collection('<collection name>')
47
47
// chain methods by using the "->" object operator
48
48
->get();
49
+ .. tip::
50
+
51
+ Before using the ``DB::collection()`` method, ensure that you specify MongoDB as your application's
52
+ default database connection. For instructions on setting the database connection,
53
+ see the :ref:`laravel-quick-start-connect-to-mongodb` step in the Quick Start.
54
+
55
+ If MongoDB is not your application's default database, you can use the ``DB::connection()`` method
56
+ to specify a MongoDB connection. Pass the name of the connection to the ``connection()`` method,
57
+ as shown in the following code:
58
+
59
+ .. code-block:: php
60
+
61
+ $connection = DB::connection('mongodb');
49
62
50
63
This guide provides examples of the following types of query builder operations:
51
64
You can’t perform that action at this time.
0 commit comments