@@ -53,13 +53,16 @@ The following example shows the syntax of a query builder call:
5353
5454.. tip:: Set Database Connection
5555
56- Before using the ``DB::table()`` method, ensure that you specify MongoDB as your application's
57- default database connection. For instructions on setting the database connection,
58- see the :ref:`laravel-quick-start-connect-to-mongodb` step in the Quick Start.
56+ Before using the ``DB::table()`` method, ensure that you specify
57+ MongoDB as your application's default database connection. For
58+ instructions on setting the database connection, see the
59+ :ref:`laravel-quick-start-connect-to-mongodb` step in the Quick
60+ Start.
5961
60- If MongoDB is not your application's default database, you can use the ``DB::connection()`` method
61- to specify a MongoDB connection. Pass the name of the connection to the ``connection()`` method,
62- as shown in the following code:
62+ If MongoDB is not your application's default database, you can use
63+ the ``DB::connection()`` method to specify a MongoDB connection. Pass
64+ the name of the connection to the ``connection()`` method, as shown
65+ in the following code:
6366
6467 .. code-block:: php
6568
@@ -68,6 +71,7 @@ The following example shows the syntax of a query builder call:
6871This guide provides examples of the following types of query builder operations:
6972
7073- :ref:`laravel-retrieve-query-builder`
74+ - :ref:`laravel-options-query-builder`
7175- :ref:`laravel-modify-results-query-builder`
7276- :ref:`laravel-mongodb-read-query-builder`
7377- :ref:`laravel-mongodb-write-query-builder`
@@ -654,6 +658,33 @@ value of ``imdb.rating`` of those matches by using the
654658 :start-after: begin aggregation with filter
655659 :end-before: end aggregation with filter
656660
661+ .. _laravel-options-query-builder:
662+ 663+ Set Query-Level Options
664+ -----------------------
665+ 666+ You can modify the way that the {+odm-short+} performs operations by
667+ setting options on the query builder. You can pass an array of options
668+ to the ``options()`` query builder method to specify options for the
669+ query.
670+ 671+ The following code demonstrates how to attach a comment to
672+ a query:
673+ 674+ .. literalinclude:: /includes/query-builder/QueryBuilderTest.php
675+ :language: php
676+ :dedent:
677+ :start-after: begin options
678+ :end-before: end options
679+ 680+ The query builder accepts the same options that you can set for
681+ the :phpmethod:`find() <phpmethod.MongoDB\\Collection::find()>` method in the
682+ {+php-library+}. Some of the options to modify query results, such as
683+ ``skip``, ``sort``, and ``limit``, are settable directly as query
684+ builder methods and are described in the
685+ :ref:`laravel-modify-results-query-builder` section of this guide. We
686+ recommend that you use these methods instead of passing them as options.
687+ 657688.. _laravel-modify-results-query-builder:
658689
659690Modify Query Results
0 commit comments