- Reference >
mongo
Shell Methods >- Cursor Methods >
- cursor.showDiskLoc()
cursor.showDiskLoc()¶
On this page
-
cursor.
showDiskLoc
()¶ Modifies the output of a query by adding a field
$diskLoc
to matching documents.$diskLoc
contains disk location information and has the form:cursor.showDiskLoc()
method is a wrapper around$showDiskLoc
.Returns: A modified cursor object that contains documents with appended information that describes the on-disk location of the document.
Example¶
The following operation appends the showDiskLoc()
method to the db.collection.find()
method in order to include
in the matching documents the disk location information:
The operation returns the following documents, which includes the
$diskLoc
field:
The projection can also access the added field $diskLoc
,
as in the following example:
The operation returns just the _id
field and the $diskLoc
field in the matching documents:
See also
$showDiskLoc
for related
functionality.