Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

119
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda