- Reference >
- Operators >
- Query Modifiers >
- $showDiskLoc
$showDiskLoc¶
On this page
-
$showDiskLoc¶ $showDiskLocoption adds a field$diskLocto the returned documents. The value of the added$diskLocfield is a document that contains the disk location information:The
mongoshell provides thecursor.showDiskLoc()method for$showDiskLoc:You can also specify the
$showDiskLocoption 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: