1

I want to run this command and get it's output using pymongo module.

db.adminCommand({getParameter: 1, logLevel: 1})

or say I want to run this command

db.adminCommand( { setParameter: 1, disableJavaScriptJIT: false } )

basically I want to get the configurations settings using mongodb shell only. I don't have access to configuration file.

0

1 Answer 1

2

On mongo shell:

db.adminCommand({getParameter: 1, logLevel: 1})

{ "logLevel" : 0, "ok" : 1 }

On python:

from pymongo import MongoClient

server = 'localhost'

port = 27017

client = MongoClient(server, port)

print(client.admin.command(({'getParameter': 1, 'logLevel': 1})))

{'logLevel': 0, 'ok': 1.0}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.