Skip to content

Commit

Permalink
dbshell: refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
WaVEV committed May 8, 2024
1 parent 05678f6 commit a02ad1c
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions django_mongodb/client.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import signal
import urllib

from django.db.backends.base.client import BaseDatabaseClient


class DatabaseClient(BaseDatabaseClient):
executable_name = "mongosh"
help_options = ("--help", "-h")

@classmethod
def settings_to_cmd_args_env(cls, settings_dict, parameters):
Expand All @@ -29,7 +27,6 @@ def settings_to_cmd_args_env(cls, settings_dict, parameters):
if user:
args += ["--username", user]
if passwd:
passwd = urllib.parse.quote_plus(passwd)
args += ["--password", passwd]
if auth_database:
args += ["--authenticationDatabase", auth_database]
Expand All @@ -38,12 +35,10 @@ def settings_to_cmd_args_env(cls, settings_dict, parameters):
if retry_writes is not None:
args += ["--retryWrites", str(retry_writes).lower()]

if dbname:
args.append(dbname)
args.append(dbname)

if parameters:
if not any(param in cls.help_options for param in parameters):
args.append("--shell")
args.append("--shell")
args += parameters
return args, None

Expand Down

0 comments on commit a02ad1c

Please sign in to comment.