npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mongo-assist

v1.0.1

Published

Handy CLI utilities for managing multiple mongo instances

Readme

Mongo Assist is a group of handy utilities for managing mongoDB instances. It can be used to :

  • Download MongoDB Databases in json/csv/excel formats.
  • Upload Data in json format to MongoDB databases.
  • Transfer data from one MongoDB database to another.

Available as a module as well as in CLI mode,

How to install

You can install mongo-assist as a dependency using NPM.

# Global so it can be called from anywhere
$ npm install -g mongo-assist
# or as a dependency of a project
$ npm install mongo-assist --save

Usage

This can be used as a Javascript module or as a command line tool.

Javascript module

It provides 3 functions -

  • downloadData - To download MongoDB Databases in json/csv/excel formats.
  • uploadToDatabase - To upload Data(in json) to MongoDB instances.
  • transferData - To transfer data from one MongoDB instance to another

Import necessary functions from mongo-assist as

import { transferData, downloadData, uploadToDatabase } from "mongo-assist";

downloadData() function can be used as -

(async () => {
  await downloadData({
      mongoURI: <mongoDB_connection_string>,
      database: <database_name>,
      type: < "json" | "csv" | "excel" >,
    });
 })();

Parameters -

  • mongoURI - Mongo DB connection string of the instance from which you want to download data.

    Example - mongodb://localhost:27017
  • database - Name of the database to download from MongoDB instance.

  • type - Type describes the way you want the data to get stored. This can be "json", "csv" or "excel".

uploadToDatabase() function can be used as -

(async () => {
  await uploadToDatabase({ dbName: <database_name>, mongoURI: <mongoDB_connection_string>, data: <data-to-upload> });
 })();

Parameters -

  • dbName - Name of the database to upload data to (If this doesn't already exist, new database will be created)

  • mongoURI - Mongo DB connection string of the instance to which you want to upload data TO.

     Example - mongodb+srv://user:[email protected]/test
  • data - Data should be in JSON format with keys as collection names and values as array of documents to upload. Illustration given below -

Data to be uploaded should be in json format as -

{
    "collectionName1":[document11, document12, ....],
    "collectionName2":[document21, document22, ....]
}

*In CLI mode, path of JSON file in above format should be provided to upload.

transferData() function can be used as -

(async () => {
   await transferData({
      transferFrom: <mongoDB_connection_string>,
      databaseFrom: <database_name>,
      transferTo: <mongoDB_connection_string>,
      databaseTo: <database_name>,
    });
 })();

Parameters -

  • transferFrom- Mongo DB connection string of the instance from which you want to transfer data FROM.
  • databaseFrom - Name of the database from which to transfer data.
  • transferTo - Mongo DB connection string of the instance to which you want to transfer data TO.
  • databaseTo - Name of the database to transfer data to -(If this doesn't already exist, new database will be created)

Test files

Test files for javascript modules can be found here

Command Line Interface

To use globally from the command line, install the package with -g flag as -

npm install -g mongo-assist

Run mongo-assist -h to display all the options and verify installation is succesful -

$ mongo-assist -h

usage: index.js [-h] [-v] [-d DOWNLOAD] [-u UPLOAD] [-t TRANSFER] [-n DATABASE2] [-x MONGOURI] [-p PATH] [-y MONGOURI2] [-e {json,excel,csv}]

Mongo Assist - Handy utilities for managing mongo instances. For detailed guide with examples - head on to https://github.com/vasusharma7/mongo-utils

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -d DOWNLOAD, --download DOWNLOAD
                        Name of Database to Download data from instance
  -u UPLOAD, --upload UPLOAD
                        Name of Database to Upload data to instance
  -t TRANSFER, --transfer TRANSFER
                        Name of Database to Transfer Data FROM
  -n DATABASE2, --database2 DATABASE2
                        Name of the database to transfer data TO - use with -t flag
  -x MONGOURI, --mongoURI MONGOURI
                        MongoDB connection string of the instance - to download from/ upload to/ transfer from
  -p PATH, --path PATH  Path of JSON file to upload data in proper format - use only with upload(-u)
  -y MONGOURI2, --mongoURI2 MONGOURI2
                        MongoDB connection string of the instance you want to transfer data to - use only with transfer(-t)
  -e {json,excel,csv}, --type {json,excel,csv}
                        Export as json/csv/excel

Note: Enclose MongoDB connection strings within quotes ""
CLI Examples -
#download data
$ mongo-assist -d test-database -e json -x "mongodb+srv://user:[email protected]/test"

#upload data
$ mongo-assist -u test-database -p ./test-database.json -x "mongodb+srv://user:[email protected]/test"

#transfer data
$ mongo-assist -t test-database -n test-database-copy -x "mongodb+srv://Vasu:[email protected]/test" -y "mongodb://localhost:27017"

Note: In CLI mode, the mongoDB connection strings should be enclosed within quotes - ""

Contributors