- Reference >
- Operators >
- Query Modifiers >
- $showDiskLoc
$showDiskLoc¶
On this page
-
$showDiskLoc
¶ $showDiskLoc
option adds a field$diskLoc
to the returned documents. The value of the added$diskLoc
field is a document that contains the disk location information:The
mongo
shell provides thecursor.showDiskLoc()
method for$showDiskLoc
:You can also specify the
$showDiskLoc
option in either of the following forms:
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: