Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Submitted
Categories MongoDB Shell
Created by Guest
Created on May 19, 2022

Make Load() support Regex Patterns or make a new loadRegex() function

## Problem Statement/Rationale Let's say you have a directory full of scripts. For now, I need to do a load('script path') for each script. Wouldn't it be great if I could do load('*') within the directory, and load them all one after the other with this one liner ? ## Expected Results load(/*/) -> all the files in the directory, sorted by alphanumerical (maybe we could also configure a locale in mongo configuration file or something like that to change collation) ## Actual Results load(Regex Pattern) doesn't work, because it searches a path. ## Additional Notes if it's too complicated to make load compatible with regex patterns, we could imagine that an other function could do the job, like findRegex() or something, where it accepts a string and this string has to be a regex pattern