MongoDB Shell
12 results found
-
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 -
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 -
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 -
mongocli improvemenet
It would be great to have API/command in mongocli to manage replica set like changing priority of replicate set in case ops manager is not accessible or part of autumation.
1 vote -
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 -
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 -
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 -
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 -
Extended JSON v2
Allow the use of Extended JSON v2 for e.g. inserting or finding documents.
1 vote -
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.conf1 vote -
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 -
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 : "databaseA", 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
- Don't see your idea?