diff --git a/source/reference/program/mongofiles.txt b/source/reference/program/mongofiles.txt index 95fc99283d2..274ef7bf86d 100644 --- a/source/reference/program/mongofiles.txt +++ b/source/reference/program/mongofiles.txt @@ -162,14 +162,34 @@ Commands system. Here, ```` refers to the name the object will have in - GridFS, and :program:`mongofiles` assumes that this reflects the name the - file has on the local file system. If the local filename is - different use the :option:`mongofiles --local` option. + GridFS. :program:`mongofiles` writes the file to the local + file system using the file's ``filename`` in GridFS. To choose a + different location for the file on the local file system, use the + :option:`--local` option. + +.. describe:: get_id "" + + .. versionadded:: 3.2.0 + + Copy the specified file from GridFS storage to the local file system. + + Here ```` refers to the extended JSON ``_id`` of the + object in GridFS. :program:`mongofiles` writes the file to the local + file system using the file's ``filename`` in GridFS. To choose a + different location for the file on the local file system, use the + :option:`--local` option. .. describe:: delete Delete the specified file from GridFS storage. +.. describe:: delete_id "" + + .. versionadded:: 3.2.0 + + Delete the specified file from GridFS storage. Specify the file using + its ``_id``. + Examples -------- @@ -229,3 +249,13 @@ database named ``32-corinth.lp``, you can use the following command: .. code-block:: sh mongofiles -d records get 32-corinth.lp + +To fetch the file from the GridFS collection in the ``records`` database +with ``_id: ObjectId("56feac751f417d0357e7140f")``, you can use +the following command: + +.. code-block:: sh + + mongofiles -d records get_id 'ObjectId("56feac751f417d0357e7140f")' + +You must include quotation marks around the ``_id``.