Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

migrate-mongo

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

migrate-mongo

A database migration tool for MongoDB in Node

  • 11.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
125K
decreased by-5.12%
Maintainers
1
Weekly downloads
 
Created

What is migrate-mongo?

The migrate-mongo npm package is a tool for managing MongoDB database migrations. It allows developers to create, run, and manage database schema changes in a controlled and versioned manner.

What are migrate-mongo's main functionalities?

Create a new migration

This feature allows you to create a new migration file. The migration file will be created in the configured migrations directory with a timestamp in its filename.

const migrateMongo = require('migrate-mongo');
migrateMongo.create('my-new-migration').then(() => {
  console.log('Migration created');
});

Run migrations

This feature runs all pending migrations. It ensures that your database schema is up-to-date with the latest changes.

const migrateMongo = require('migrate-mongo');
migrateMongo.up().then((migrated) => {
  console.log('Migrations up:', migrated);
});

Rollback migrations

This feature rolls back the last applied migration. It is useful for undoing changes in case of errors or issues.

const migrateMongo = require('migrate-mongo');
migrateMongo.down().then((migrated) => {
  console.log('Migrations down:', migrated);
});

Configure migrate-mongo

This feature allows you to configure the connection to your MongoDB database and other settings like the migrations directory and changelog collection name.

const migrateMongo = require('migrate-mongo');
const config = {
  mongodb: {
    url: 'mongodb://localhost:27017/mydatabase',
    databaseName: 'mydatabase',
    options: {
      useNewUrlParser: true,
      useUnifiedTopology: true
    }
  },
  migrationsDir: 'migrations',
  changelogCollectionName: 'changelog'
};
migrateMongo.config.set(config);

Other packages similar to migrate-mongo

Keywords

FAQs

Package last updated on 25 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc