This version of the documentation is archived and no longer supported.


db.collection.findOne(query, projection)
  • query (document) – Optional. A document that specifies the query using the JSON-like syntax and query operators.
  • projection (document) –

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

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

    The boolean can take the following include or exclude values:

    • 1 or true to include. The findOne() method always includes the _id field even if the field is not explicitly stated to return in the 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.


One document that satisfies the query specified as the 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 document according to the natural order which reflects the order of documents on the disc. In capped collections, natural order is the same as insertion order.