@@ -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`
@@ -647,6 +651,33 @@ value of ``imdb.rating`` of those matches by using the
647651 :start-after: begin aggregation with filter
648652 :end-before: end aggregation with filter
649653
654+ .. _laravel-options-query-builder:
655+
656+ Set Query-Level Options
657+ -----------------------
658+
659+ You can modify the way that the {+odm-short+} performs operations by
660+ setting options on the query builder. You can pass an array of options
661+ to the ``options()`` query builder method to specify options for the
662+ query.
663+
664+ The following code demonstrates how to attach a comment to
665+ a query:
666+
667+ .. literalinclude:: /includes/query-builder/QueryBuilderTest.php
668+ :language: php
669+ :dedent:
670+ :start-after: begin options
671+ :end-before: end options
672+
673+ The query builder accepts the same options that you can set for
674+ the :phpmethod:`find() <phpmethod.MongoDB\\Collection::find()>` method in the
675+ {+php-library+}. Some of the options to modify query results, such as
676+ ``skip``, ``sort``, and ``limit``, are settable directly as query
677+ builder methods and are described in the
678+ :ref:`laravel-modify-results-query-builder` section of this guide. We
679+ recommend that you use these methods instead of passing them as options.
680+
650681.. _laravel-modify-results-query-builder:
651682
652683Modify Query Results
0 commit comments