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

121
Visualizações
Mongoose Export and Import MongoDB Documents to/from File

Using JavaScript and Mongoose, I want to export all of the documents of a certain document class to a file (e.g., a JSON or CSV file), and I also want to import (i.e., "load") the contents of such a file into a database. How can I accomplish this?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

From mongoDB docs:

EXPORT / BACKUP

To backup data from a mongod instance running on the same machine and on the default port of 27017, use the following command:

mongodump

You can also specify the --host and --port of the MongoDB instance that the mongodump should connect to. For example:

mongodump --host=mongodb.example.net --port=27017

mongodump will write BSON files that hold a copy of data accessible via the mongod listening on port 27017 of the mongodb.example.net host. See Create Backups from Non-Local mongod Instances for more information.

To specify a different output directory, you can use the --out or -o option:

mongodump --out=/data/backup/

IMPORT / RESTORE

To use mongorestore to connect to an active mongod, use a command with the following prototype form:

mongorestore --port=<port number> <path to the backup>

Consider the following example:

mongorestore dump-2013-10-25/

MongoDB Docs: Check

about 4 years ago · Juan Pablo Isaza 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