Configuration
Databases
MongoDB

MongoDB

GoBackup uses mongodump utility to backup MongoDB database files.

Install tool

Config keys

type: mongodb

  • uri - MongoDB connection URI, for example: mongodb://root:root@localhost:27017/my_app_production?authSource=admin, if you have present this, then host, port, username, password, database will be ignored.
  • host - MongoDB server host, default: 127.0.0.1
  • port - MongoDB server port, default: 27017
  • socket - MongoDB server, if use socket, for example: /tmp/mongodb-27017.sock, default: ``
  • database - database name
  • username - default: ``, keep empty can use empty password.
  • password
  • authdb - authenticationDatabase arg or mongodump
  • oplog - oplog arg or mongodump, default: false
  • exclude_tables - Array of collections to exclude from backup, default: []
  • args - Additional options for mongodump utility, for example: --gzip --dumpDbUsersAndRoles

https://github.com/huacnlee/gobackup/blob/master/database/mongodb.go (opens in a new tab)

Example

models:
  my_app:
    databases:
      my_app:
        type: mongodb
        host: 127.0.0.1
        port: 27017
        database: my_app_production
        username: root
        password: root
        oplog: true
        exclude_tables:
          - collection1
          - collection2
        args: --gzip --dumpDbUsersAndRoles