On this page
Changed in version 3.2: This method replaces the previous
Modifies the output of a query by adding a field
$recordIdto matching documents.
$recordIdis the internal key which uniquely identifies a document in a collection. It has the form:
Returns: A modified cursor object that contains documents with appended information describing the internal record key.
The operation returns the following documents, which include the
You can project the added field
$recordId, as in the following example:
This query returns only the
_id field and the
$recordId field in the matching documents: