On this page本页内容
cursor.showRecordId()¶mongo Shell Method
This page documents the 本页记录了mongo shell method, and does not refer to the MongoDB Node.js driver (or any other driver) method. mongo shell方法,未提及MongoDB Node.js驱动程序(或任何其他驱动程序)方法。For corresponding MongoDB driver API, refer to your specific MongoDB driver documentation instead.有关相应的MongoDB驱动程序API,请参阅特定的MongoDB驱动程序文档。
Changed in version 3.2.在版本3.2中更改。This method replaces the previous 此方法将替换以前的cursor.showDiskLoc().cursor.showDiskLoc()。
Modifies the output of a query by adding a field 通过向匹配文档添加字段$recordId to matching documents. $recordId来修改查询的输出。$recordId is the internal key which uniquely identifies a document in a collection. $recordId是唯一标识集合中文档的内部密钥。It has the form:其形式如下:
| Returns: |
|---|
The following operation appends the 以下操作将showRecordId() method to the db.collection.find() method in order to include storage engine record information in the matching documents:showRecordId()方法附加到db.collection.find()方法,以便在匹配的文档中包含存储引擎记录信息:
The operation returns the following documents, which include the 该操作返回以下文档,其中包括$recordId field:$recordId字段:
You can project the added field 您可以投影添加的字段$recordId, as in the following example:$recordId,如下例所示:
This query returns only the 此查询仅返回匹配文档中的_id field and the $recordId field in the matching documents:_id字段和$recordId字段: