Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

381
Visualizações
MongoDb, Cloning database error: illegal argument combination: cannot specify --db and --uri

I am trying to duplicate a database called database_A in the same cluster.
The result should be a new database called database_B with the exact same data.

I am trying to follow the instructions here.

It explains how to do this locally:

  1. Use mongodump to dump the test database to an archive mongodump-test-db:

mongodump --archive="mongodump-test-db" --db=test

  1. Use mongorestore with --nsFrom and --nsTo to restore (with database name change) from the archive:

mongorestore --archive="mongodump-test-db" --nsFrom='test.' --nsTo='examples.'

In order to achieve the same result in the cluster, it says:

Include additional options as necessary, such as to specify the uri or host, username, password and authentication database.

However, when I try to add the uri to achieve the first step:

mongodump --uri mongodb+srv://hihi:password@cluster0.fklgt.mongodb.net --archive="mongodump-test-db" --db=test_db

I get this error:

illegal argument combination: cannot specify --db and --uri

Any idea how to solve this?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You have to add db in URI- like connection uri/[db]

mongodb+srv://hihi:password@cluster0.fklgt.mongodb.net/test_db


mongodump --uri mongodb+srv://hihi:password@cluster0.fklgt.mongodb.net/test_db --archive="mongodump-test-db" 

https://docs.mongodb.com/v3.6/reference/program/mongodump/#cmdoption-mongodump-uri

/database Optional. The name of the database to authenticate if the connection string includes authentication credentials in the form of username:password@. If /database is not specified and the connection string includes credentials, the driver will authenticate to the admin database. See also authSource.

https://docs.mongodb.com/v3.6/reference/connection-string/

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda