#!/bin/bash
set -e

for file in /docker-entrypoint-initdb.d/*.json; do
  collection=$(basename "$file" .json)
  echo "Importing $collection..."
  mongoimport --db mydb --collection "$collection" --file "$file" --jsonArray
done
