Skip to content

MongoDB Shell

The MongoDB Shell (mongosh) lets you connect to MongoDB to work with your data and configure your database.

Help us improve the MongoDB Shell by posting your ideas and suggestions for improvements.

To report bugs, please use our MONGOSH JIRA project.

12 results found

  1. Add support for AWS_PROFILE when authMechanism is MONGODB-AWS

    Currently, when using MONGODB-AWS, it can only read the following variables:

    AWS ACCESS KEY ID
    AWS SECRET ACCESS KEY
    AWS SESSION TOKEN

    which forces you to export credentials or to paste them in the CLI.

    AWS has a variable called AWS_PROFILE that will fetch the required values from your credential file, without having to paste them again. This variable is supported by anything using AWS SDK, so mongosh should have support for it as well.

    10 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Commands  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  2. Add support for db.exists() and collections.exists()

    Add a db.exists() and collections.exists() so that it is easy to check whether a database or a collection exists. This will help to reduce the propensity to inadvertently create new dbs and collections when running a script due to typos.

    5 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    under review  ·  2 comments  ·  Commands  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  3. Explain shell helpers for CRUD API

    The .explain() method in the shell works with some write methods (update, remove, findAndModify), but it doesn't work with the newer CRUD API.

    The missing explain methods are:

    "deleteMany",
    "deleteOne",
    "findOne",
    "findOneAndDelete",
    "findOneAndReplace",
    "findOneAndUpdate",
    "insertMany",
    "insertOne",
    "replaceOne",
    "updateMany",
    "updateOne"

    I think this would be especially helpful for new hires: explain is a good way to quickly find the code that implements a command.

    4 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Commands  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  4. creating an option to import csv files with semicolon separator

    There isn't an option to specify semicolon as delimiter on mongo shell when importing csv files. We are forced to import through MongoDB Compass when file has semicolon separator.

    3 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Commands  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  5. Have db.table.distinct('column') support cursors

    Right now distinct() returns max 100 items and doesn't take into account the config "displayBatchSize". It would be nice if distinct() returned all distinct items.

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Commands  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  6. 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…

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Commands  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  7. Add support for AWS SSO when authMechanism is MONGODB-AWS

    Currently MONGODB-AWS authentication mechanism doesn't support AWS SSO. User has to manually run aws sso get-role-credentials to retrieve the temporary credentials first.

    All AWS SDK support SSO out of the box, therefore mongosh should add support for it too.

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Commands  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  8. Support git command

    MongoSh is a developer tool, obviously. So as a developer, git is always a part of it. Supporting git command inside mongosh will help us save a lot of time.

    Here's some of my implementation:

    const git = (command) => {
    try {
    return execSync(`git ${command}`).toString();
    } catch (e) {};
    return null;
    };
    const listBranches = () => {
    const branches = git(`branch -a`).split(/\r\n|\n|\r/).filter(notEmpty);
    return branches.map(branchObj);
    };
    const pull = (remote = 'origin') => {
    return git(`pull ${remote} --rebase`);
    };
    const log = (cnt) => {
    const _cnt = Number(cnt) || 32;
    return git(`log --graph --all --oneline --decorate=short --max-count=${_cnt}`);
    }

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Commands  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  9. Extended JSON v2

    Allow the use of Extended JSON v2 for e.g. inserting or finding documents.

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Commands  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  10. Add a command to change date format when logrotate is used

    After testing db.adminCommand( { logRotate : 1 } ), the following file was generated:
    /var/log/mongodb/mongod.log.2021-07-05T15-09-17. It would be good to add command to change date format. E.g. yyyymmdd-hhmmss and also it could be specified as variable in mongod.conf

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  Commands  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  11. Change naming conventions to more inclusive terms. For example "slaveDelay" to "workerDelay" or "rs.isMaster" to "rs.isMain"

    There is an initiative in the tech community to replace non-inclusive terms with more inclusive ones and I'd like to get the community's take on it. I think the biggest offenders are terminology referring to "slaves" and "masters", but I'm sure there are others that might fall into that category. Although I'm sure nobody meant any harm by using these terms, I think we can and should do better.

    I'm currently working my way through the m103 replication course and I see in replication configuring there's a term "slaveDelay". Also a "rs.isMaster()" method. I'm suggesting replacing "slave" with "worker" and…

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    started  ·  2 comments  ·  Commands  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  12. create custom role with list of collection

    currently, when creating a role, we need to list one collection per db for custom role

    db.getSisterDB('admin').createRole({role : 'readWriteCollectionXY',
    privileges : [ {resource : {db : "databaseA", collection : "***"}, actions : ["find", "insert", "update"]},
    {resource : {db : "database
    A", collection : "yyy"}, actions : ["find", "insert", "update"]} ],
    roles : []
    })

    having an option to list all the collections in one db with the same permission would be a nice thing to have.

    db.getSisterDB('admin').createRole({role : 'readWriteCollectionXY',
    privileges : [ {resource : {db : "database_A", collections : ["***", "yyy"] }, actions : ["find", "insert", "update"]} ],
    roles…

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Commands  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  • Don't see your idea?

MongoDB Shell

Categories

Feedback and Knowledge Base