#!/bin/bash
# USAGE: mongoload db_name collection_name file_with_json_array

USERNAME=YOUR_USERNAME
PASSWORD=YOUR_PASSWORD
SERVER=YOUR_SERVER_NAME # but without the leading mongodb+srv:// portion
URI="mongodb+srv://$USERNAME:$PASSWORD@$SERVER"  # do not touch this line

if [ $# -ne 3 ]
   then
      echo "Usage: mongoload db_name collection_name file_with_json_array"
      exit 1
fi

mongoimport --uri $URI/$1 --collection $2 --type json --file $3 --jsonArray
