@@ -519,26 +519,36 @@ Commands
519
519
Lists the files in the GridFS store with names that match any
520
520
portion of ``<string>``.
521
521
522
- .. describe:: put <filename >
522
+ .. describe:: put <filename1[ filename2] ... >
523
523
524
- Copy the specified file from the local file system into GridFS
525
- storage.
524
+ Copy the specified file or files from the local file system into
525
+ GridFS storage. Multiple files can be specified as a space-separated
526
+ list.
526
527
527
- Here, ``< filename>`` refers to the name the object will have in
528
- GridFS, and :binary:`~bin.mongofiles` assumes that this reflects the name the
529
- file has on the local file system. If the local filename is
530
- different use the :option:`mongofiles --local` option.
528
+ Each specified filename refers to the name the object will have in
529
+ GridFS, and :binary:`~bin.mongofiles` assumes that this reflects the
530
+ name the file has on the local file system. If the local filename is
531
+ different, use the :option:`mongofiles --local` option.
531
532
532
- .. describe:: get <filename >
533
+ .. describe:: get <filename1[ filename2] ... >
533
534
534
- Copy the specified file from GridFS storage to the local file
535
- system.
535
+ Copy the specified file or files from GridFS storage to the local
536
+ file system.
536
537
537
- Here, ``<filename>`` refers to the name the object will have in
538
- GridFS. :binary:`~bin.mongofiles` writes the file to the local
539
- file system using the file's ``filename`` in GridFS. To choose a
540
- different location for the file on the local file system, use the
541
- :option:`--local <mongofiles --local>` option.
538
+ Each specified filename refers to the name the object has in
539
+ GridFS, and :binary:`~bin.mongofiles` will use this filename when
540
+ writing to the local file system.
541
+
542
+ If specifying *only one* ``filename`` to the ``get`` command, you can
543
+ use the :option:`--local <mongofiles --local>` option to specify a
544
+ different local filename to write to, if desired. The
545
+ :option:`--local <mongofiles --local>` option **cannot** be used if
546
+ specifying *more than one* ``filename`` to the ``get`` command.
547
+
548
+ .. note:
549
+
550
+ To copy files from GridFS storage that match a regular expression,
551
+ use the ``get_regex`` command instead.
542
552
543
553
.. describe:: get_id "<_id>"
544
554
@@ -548,10 +558,29 @@ Commands
548
558
non-ObjectId values for ``<_id>``.
549
559
550
560
:binary:`~bin.mongofiles` writes the file to the local
551
- file system using the file's `` filename`` in GridFS. To choose a
561
+ file system using the file's filename in GridFS. To choose a
552
562
different location for the file on the local file system, use the
553
563
:option:`--local <mongofiles --local>` option.
554
564
565
+ .. describe:: get_regex <regex> --regexOptions <regex-options>
566
+
567
+ Copy the file or files, matched by the specified ``<regex>``
568
+ expression, from GridFS storage to the local file system. The
569
+ ``get_regex`` command uses Perl compatible regular expressions
570
+ ("PCRE") version 8.42 with UTF-8 support.
571
+
572
+ You may optionally specify one or more ``<regex-options>`` using the
573
+ ``--regexOptions`` flag. These can be any of the
574
+ :ref:`options supported by the $regex operator
575
+ <regex-query-options>`, which include settings such as
576
+ case-insensitivity. Multiple options should be provided together
577
+ without separators, e.g. ``--regexOptions si``
578
+
579
+ :binary:`~bin.mongofiles` writes the file or files to the local
580
+ file system using each file's matched filename in GridFS. You
581
+ **cannot** use the :option:`--local <mongofiles --local>` option with
582
+ the ``get_regex`` command.
583
+
555
584
.. describe:: delete <filename>
556
585
557
586
Delete the specified file from GridFS storage.
@@ -611,7 +640,8 @@ following command:
611
640
mongofiles -d=records search corinth
612
641
613
642
To list all files in the GridFS collection in the ``records`` database
614
- that begin with the string ``32``, you can use the following command:
643
+ with names that begin with the string ``32``, you can use the following
644
+ command:
615
645
616
646
.. code-block:: sh
617
647
@@ -624,6 +654,14 @@ database named ``32-corinth.lp``, you can use the following command:
624
654
625
655
mongofiles -d=records get 32-corinth.lp
626
656
657
+ To fetch all files from the GridFS collection in the ``records``
658
+ database with names beginning with the string ``32`` and ending with the
659
+ string ``.lp``, you can use the following command:
660
+
661
+ .. code-block:: sh
662
+
663
+ mongofiles -d=records get_regex 32*.lp
664
+
627
665
To fetch the file from the GridFS collection in the ``records`` database
628
666
with ``_id: ObjectId("56feac751f417d0357e7140f")``, you can use the
629
667
following command:
0 commit comments