Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
1 answer
678 views

Shell Script to kill slow running Mongo Queries

I need to create a shell script that finds and kills long running mongo queries more than a specified threshold e.g. 15sec I plan to use db.currentOp(); and db.killOp(); to find and kill queries but I ...
DB guy's user avatar
  • 69
1 vote
0 answers
888 views

How to simulate slow queries on MongoDB

I need to write a shell script that finds and kills long running mongodb queries, but I don't have access to the database that runs slow queries, how to I simulate running slow queries on my local ...
DB guy's user avatar
  • 69
0 votes
0 answers
144 views

Appropriate language to write a Script that Kills Long running query MongoDB

I want to create a script that kills queries when they reach specific time threshold, I will be using db.currentOp() method to get information about currently running queries, and use db.killOp to ...
DB guy's user avatar
  • 69
1 vote
0 answers
2k views

Show Collections in MongoDB throwing

I am connecting to MongoDB hosted on EC2 instance of AWS. I am connecting through ssh command. Upon entering the command "show collections", I am getting uncaught exceptions. Please see the sequence ...
RB17's user avatar
  • 117
0 votes
1 answer
2k views

Capturing mongo replica set state from mongo shell

I am trying to capture mongo replica set state from mongo shell. E.g. [root@server ~]$ mongo MongoDB shell version v3.6.8 connecting to: mongodb://127.0.0.1:27017 MongoDB server version: 3.6.8 rs0:...
Howard Lee's user avatar
  • 1,019
0 votes
1 answer
973 views

MongoDB scripts triggered by cron - how to achieve reasonable password security

We would like to do nightly purging of old data out of our mongo cluster. First thought is to write shell script which connects to one of the mongos and issues a remove instruction. evalString='db.fs....
ubienewbie's user avatar
1 vote
1 answer
442 views

Arguments for MongoDB backup with OpsManager or mongodump?

I have a replica set of two MongoDB nodes running (with an arbiter) and I am now wondering about the best backup and recovery solution. I am aware of the official documentation, but it does not ...
B--rian's user avatar
  • 113
4 votes
3 answers
5k views

parse rs.status() output to display one secondary node for mongodump destination

I wish to run mongodump to secondary (not primary). So I need as output hostname and port of one secondary. # ./mongo -udbadm admin --port 27100 -p --quiet --eval "printjson(rs.status().members.map(...
Sybil's user avatar
  • 2,558
3 votes
1 answer
8k views

executing shell (bash) commands from within the mongo client

How can I execute shell (bash) commands from within the MongoDB client? With MySQL client: system (!) Execute a system shell command. Is there something similar for MongoDB?
Sybil's user avatar
  • 2,558