|
| 1 | +``$filter`` : array|object |
| 2 | + The filter criteria that specifies the documents to query. |
| 3 | + |
| 4 | +``$options`` : array |
| 5 | + An array specifying the desired options. |
| 6 | + |
| 7 | + .. list-table:: |
| 8 | + :header-rows: 1 |
| 9 | + :widths: 20 20 80 |
| 10 | + |
| 11 | + * - Name |
| 12 | + - Type |
| 13 | + - Description |
| 14 | + |
| 15 | + * - allowDiskUse |
| 16 | + - boolean |
| 17 | + - Enables writing to temporary files. When set to ``true``, queries can |
| 18 | + write data to the ``_tmp`` sub-directory in the ``dbPath`` directory. |
| 19 | + |
| 20 | + * - allowPartialResults |
| 21 | + - boolean |
| 22 | + - For queries against a sharded collection, returns partial results from |
| 23 | + the :program:`mongos` if some shards are unavailable instead of |
| 24 | + throwing an error. |
| 25 | + |
| 26 | + * - batchSize |
| 27 | + - integer |
| 28 | + - The number of documents to return in the first batch. Defaults to |
| 29 | + ``101``. A batchSize of ``0`` means that the cursor will be |
| 30 | + established, but no documents will be returned in the first batch. |
| 31 | + |
| 32 | + Unlike the previous wire protocol version, a batchSize of ``1`` for the |
| 33 | + :dbcommand:`find` command does not close the cursor. |
| 34 | + |
| 35 | + * - codec |
| 36 | + - MongoDB\\Codec\\DocumentCodec |
| 37 | + - .. include:: /includes/extracts/collection-option-codec.rst |
| 38 | + |
| 39 | + .. versionadded:: 1.17 |
| 40 | + |
| 41 | + * - collation |
| 42 | + - array|object |
| 43 | + - .. include:: /includes/extracts/collection-option-collation.rst |
| 44 | + |
| 45 | + * - comment |
| 46 | + - mixed |
| 47 | + - .. include:: /includes/extracts/common-option-comment.rst |
| 48 | + |
| 49 | + .. include:: /includes/extracts/common-option-comment-string-before-4.4.rst |
| 50 | + |
| 51 | + * - cursorType |
| 52 | + - integer |
| 53 | + - Indicates the type of cursor to use. ``cursorType`` supports the |
| 54 | + following values: |
| 55 | + |
| 56 | + - ``MongoDB\Operation\Find::NON_TAILABLE`` (*default*) |
| 57 | + - ``MongoDB\Operation\Find::TAILABLE`` |
| 58 | + |
| 59 | + * - hint |
| 60 | + - string|array|object |
| 61 | + - .. include:: /includes/extracts/common-option-hint.rst |
| 62 | + |
| 63 | + .. versionadded:: 1.2 |
| 64 | + |
| 65 | + * - let |
| 66 | + - array|object |
| 67 | + - .. include:: /includes/extracts/common-option-let.rst |
| 68 | + |
| 69 | + .. versionadded:: 1.13 |
| 70 | + |
| 71 | + * - limit |
| 72 | + - integer |
| 73 | + - The maximum number of documents to return. If unspecified, then |
| 74 | + defaults to no limit. A limit of ``0`` is equivalent to setting no |
| 75 | + limit. |
| 76 | + |
| 77 | + A negative limit is similar to a positive limit but closes the cursor |
| 78 | + after returning a single batch of results. As such, with a negative |
| 79 | + limit, if the limited result set does not fit into a single batch, the |
| 80 | + number of documents received will be less than the specified limit. By |
| 81 | + passing a negative limit, the client indicates to the server that it |
| 82 | + will not ask for a subsequent batch via getMore. |
| 83 | + |
| 84 | + * - max |
| 85 | + - array|object |
| 86 | + - The exclusive upper bound for a specific index. |
| 87 | + |
| 88 | + .. versionadded:: 1.2 |
| 89 | + |
| 90 | + * - maxAwaitTimeMS |
| 91 | + - integer |
| 92 | + - Positive integer denoting the time limit in milliseconds for the server |
| 93 | + to block a getMore operation if no data is available. This option |
| 94 | + should only be used if cursorType is ``TAILABLE_AWAIT``. |
| 95 | + |
| 96 | + .. versionadded:: 1.2 |
| 97 | + |
| 98 | + * - maxTimeMS |
| 99 | + - integer |
| 100 | + - .. include:: /includes/extracts/common-option-maxTimeMS.rst |
| 101 | + |
| 102 | + * - min |
| 103 | + - array|object |
| 104 | + - The inclusive lower bound for a specific index. |
| 105 | + |
| 106 | + .. versionadded:: 1.2 |
| 107 | + |
| 108 | + * - noCursorTimeout |
| 109 | + - boolean |
| 110 | + - Prevents the server from timing out idle cursors after an inactivity |
| 111 | + period (10 minutes). |
| 112 | + |
| 113 | + * - projection |
| 114 | + - array|object |
| 115 | + - The :ref:`projection specification <projections>` to determine which |
| 116 | + fields to include in the returned documents. See |
| 117 | + :manual:`Project Fields to Return from Query </tutorial/project-fields-from-query-results>` |
| 118 | + and :manual:`Projection Operators </reference/operator/projection>` in |
| 119 | + the MongoDB manual. |
| 120 | + |
| 121 | + * - readConcern |
| 122 | + - :php:`MongoDB\Driver\ReadConcern <class.mongodb-driver-readconcern>` |
| 123 | + - .. include:: /includes/extracts/collection-option-readConcern.rst |
| 124 | + |
| 125 | + .. include:: /includes/extracts/common-option-readConcern-transaction.rst |
| 126 | + |
| 127 | + * - readPreference |
| 128 | + - :php:`MongoDB\Driver\ReadPreference <class.mongodb-driver-readpreference>` |
| 129 | + - .. include:: /includes/extracts/collection-option-readPreference.rst |
| 130 | + |
| 131 | + * - returnKey |
| 132 | + - boolean |
| 133 | + - If true, returns only the index keys in the resulting documents. |
| 134 | + |
| 135 | + .. versionadded:: 1.2 |
| 136 | + |
| 137 | + * - session |
| 138 | + - :php:`MongoDB\Driver\Session <class.mongodb-driver-session>` |
| 139 | + - .. include:: /includes/extracts/common-option-session.rst |
| 140 | + |
| 141 | + .. versionadded:: 1.3 |
| 142 | + |
| 143 | + * - showRecordId |
| 144 | + - boolean |
| 145 | + - Determines whether to return the record identifier for each document. |
| 146 | + If true, adds a field ``$recordId`` to the returned documents. |
| 147 | + |
| 148 | + .. versionadded:: 1.2 |
| 149 | + |
| 150 | + * - skip |
| 151 | + - integer |
| 152 | + - Number of documents to skip. Defaults to ``0``. |
| 153 | + |
| 154 | + * - sort |
| 155 | + - array|object |
| 156 | + - The sort specification for the ordering of the results. |
| 157 | + |
| 158 | + * - typeMap |
| 159 | + - array |
| 160 | + - .. include:: /includes/extracts/collection-option-typeMap.rst |
0 commit comments