Skip to content

Trivial DOCS-1049 missing projection argument in findOne method reference #590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 28, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions source/reference/method/db.collection.find.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,17 @@ db.collection.find()

The ``projection`` cannot contain both include and exclude
specifications except for the exclusion of the ``_id`` field.

Omit the ``projection`` parameter to return **all** the fields in
the matching documents.

:returns:

A :term:`cursor` to the documents that match
the ``query`` criteria and contain the ``projection`` fields.
A :term:`cursor` to the documents that match the ``query``
criteria. If the ``projection`` argument is specified, the
matching documents contain only the ``projection`` fields, and
the ``_id`` field if you do not explicitly exclude the ``_id``
field.

.. note::

Expand Down
32 changes: 30 additions & 2 deletions source/reference/method/db.collection.findOne.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,42 @@ db.collection.findOne()

.. default-domain:: mongodb

.. method:: db.collection.findOne(query)
.. method:: db.collection.findOne(query,projection)

:param document query: Optional. A :term:`document` that specifies the :term:`query`
using the JSON-like syntax and :doc:`query operators
</reference/operators>`.
:param document projection:

Optional. Controls the fields to return, or the
:term:`projection`. The ``projection`` argument will
resemble the following prototype:

.. code-block:: javascript

{ field1: boolean, field2: boolean ... }

The ``boolean`` can take the following include or exclude
values:

- ``1`` or ``true`` to include. The
:method:`~db.collection.findOne()` method always includes
the :term:`_id` field even if the field is not explicitly
stated to return in the :term:`projection` parameter.

- ``0`` or ``false`` to exclude.

The ``projection`` cannot contain both include and exclude
specifications except for the exclusion of the ``_id`` field.

Omit the ``projection`` parameter to return **all** the fields in
the matching documents.

:returns: One document that satisfies the query specified as the
argument to this method.
argument to this method. If the ``projection`` argument is
specified, the returned document contains only the
``projection`` fields, and the ``_id`` field if you do not
explicitly exclude the ``_id`` field.

Returns only one document that satisfies the specified query. If
multiple documents satisfy the query, this method returns the first
Expand Down